Skip to the content
Documentation

exp:expviewcountupdate

No ratings yet

Available since Exponential 6.0.15 (in development, not in a release yet).

Summary

Count the page views of the web server's access logs into the view counter (ezview_counter), for one siteaccess or several

Usage

./console exp:expviewcountupdate [options]
php bin/php/expviewcountupdate.php [options]
./console exp:viewcount:update [options]

Aliases

exp:viewcount:update

Help

The output of ./console help exp:expviewcountupdate (the script run with --help), without the standard options:

Usage: bin/php/expviewcountupdate.php [OPTION]...
Count the page views of the web server's access logs into the view counter (ezview_counter)
Reads each siteaccess's access log (logfile.ini [AccessLogFileSettings]) from where the last run
stopped, keeps the page views (logfile.ini [ViewCountSettings]) and adds them to the nodes they
showed. Several siteaccesses sharing one log are told apart by the kernel's siteaccess matching.

./console exp:viewcount:update --dry-run --top=20          what a run would count, nothing written
./console exp:viewcount:update                              count (as the cronjob updateviewcount.php)
./console exp:viewcount:update --all-siteaccesses           every siteaccess with a log, not the administrations
./console exp:viewcount:update --siteaccess-list=site,bold  these siteaccesses
./console exp:viewcount:update --dry-run --from-start       the whole log again, as a preview only
./console exp:viewcount:update --skip-to-end                start counting from now: mark the logs as read
./console exp:viewcount:update --reset-state                forget where the runs stopped (the next run reads
                                                            the logs from their first line)
./console exp:viewcount:update --dry-run --format=json      the report as JSON (exp-viewcount/1)
./console exp:viewcount:update --all-siteaccesses --dry-run --log-file=/var/log/httpd/access_log.1 \
      --state-dir=var/tmp/viewcount-trial                    a trial on another log, with a state of its own

Exit code: 0 fine, 1 an error (a log missing, the database refused the counts), 2 usage error,
3 another run held the lock of a log.


Options:
  --dry-run                Read and report, write neither the counts nor the resume state
  --all-siteaccesses       Every siteaccess of AvailableSiteAccessList with an access log, except the administrations
  --siteaccess-list=VALUE  These siteaccesses, comma separated (default: logfile.ini [ViewCountSettings] SiteAccessList[], else the siteaccess of -s)
  --log-file=VALUE         Read this access log for every counted siteaccess, in place of logfile.ini [AccessLogFileSettings]
  --state-dir=VALUE        Keep the resume state here, in place of logfile.ini [ViewCountSettings] StateDir
  --from-start             With --dry-run: read the logs from their first line, ignoring the resume state
  --skip-to-end            Count nothing; set the resume state to the end of the logs, so the next run counts only newer lines
  --reset-state            Count nothing; remove the resume state of the siteaccesses, so the next run reads the logs from their first line
  --top=VALUE              List the most viewed nodes of the run (default 0, none)
  --format=VALUE           text (default) or json

Options

Option Value Description
--dry-run - Read and report, write neither the counts nor the resume state
--all-siteaccesses - Every siteaccess of AvailableSiteAccessList with an access log, except the administrations
--siteaccess-list required These siteaccesses, comma separated (default: logfile.ini [ViewCountSettings] SiteAccessList[], else the siteaccess of -s)
--log-file required Read this access log for every counted siteaccess, in place of logfile.ini [AccessLogFileSettings]
--state-dir required Keep the resume state here, in place of logfile.ini [ViewCountSettings] StateDir
--from-start - With --dry-run: read the logs from their first line, ignoring the resume state
--skip-to-end - Count nothing; set the resume state to the end of the logs, so the next run counts only newer lines
--reset-state - Count nothing; remove the resume state of the siteaccesses, so the next run reads the logs from their first line
--top required List the most viewed nodes of the run (default 0, none)
--format required text (default) or json

Standard options

Every script also takes the standard options of the script framework: --help, --quiet, --siteaccess, --debug, --colors, --no-colors, --logfiles, --no-logfiles, --verbose and --allow-root-user.

Source

bin/php/expviewcountupdate.php, kernel/private/classes/commands/expviewcountupdate.php

See also

Generated example: exp:expviewcountupdate

Added to the reference for Exponential 6.0.15.

Contributors

Comments

Add a comment

Comments are read by a moderator before they appear.