exp:expviewcountupdate
Count the page views of the web server's access logs into the view counter (ezview_counter), for one siteaccess or several.
Script bin/php/expviewcountupdate.php, code in kernel/private/classes/commands/expviewcountupdate.php. Run it from the installation root, as the user the web server runs as:
./console exp:expviewcountupdate --help
./console exp:viewcount:update --help
php bin/php/expviewcountupdate.php --helpHelp text
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
| Option | Value | Help |
|---|---|---|
--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 |
Read from the option definitions in the code (startup(), getOptions(), options() or ezcConsoleOption). Every script also takes the standard options of the script framework (--help, --siteaccess, --debug, --quiet, --allow-root-user ...).
Related
Generated by ./console exp:help:examples from bin/php/expviewcountupdate.php, kernel/private/classes/commands/expviewcountupdate.php. Do not edit this page: change the source and generate again (how). Free documentation: GFDL 1.3 or later.