PDF rausgenommen
This commit is contained in:
5
msd2/tracking/piwik/misc/cron/.htaccess
Normal file
5
msd2/tracking/piwik/misc/cron/.htaccess
Normal file
@ -0,0 +1,5 @@
|
||||
# Allow direct web access to Web cron
|
||||
<Files "archive.php">
|
||||
Order Allow,Deny
|
||||
Allow from all
|
||||
</Files>
|
71
msd2/tracking/piwik/misc/cron/archive.php
Normal file
71
msd2/tracking/piwik/misc/cron/archive.php
Normal file
@ -0,0 +1,71 @@
|
||||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
* @category Piwik
|
||||
* @package Piwik
|
||||
*/
|
||||
|
||||
if (!defined('PIWIK_DOCUMENT_ROOT')) {
|
||||
define('PIWIK_DOCUMENT_ROOT', realpath(dirname(__FILE__) . "/../.."));
|
||||
}
|
||||
|
||||
if (!defined('PIWIK_INCLUDE_PATH')) {
|
||||
define('PIWIK_INCLUDE_PATH', PIWIK_DOCUMENT_ROOT);
|
||||
}
|
||||
|
||||
if (!defined('PIWIK_USER_PATH')) {
|
||||
define('PIWIK_USER_PATH', PIWIK_INCLUDE_PATH);
|
||||
}
|
||||
|
||||
define('PIWIK_ENABLE_ERROR_HANDLER', false);
|
||||
define('PIWIK_ENABLE_SESSION_START', false);
|
||||
|
||||
require_once PIWIK_INCLUDE_PATH . '/core/Common.php';
|
||||
|
||||
if (Piwik\Common::isPhpCliMode()) {
|
||||
require_once PIWIK_INCLUDE_PATH . "/core/bootstrap.php";
|
||||
|
||||
$console = new Piwik\Console();
|
||||
|
||||
// manipulate command line arguments so CoreArchiver command will be executed
|
||||
$script = array_shift($_SERVER['argv']);
|
||||
$piwikHome = PIWIK_INCLUDE_PATH;
|
||||
|
||||
echo "
|
||||
-------------------------------------------------------
|
||||
Using this 'archive.php' script is no longer recommended.
|
||||
Please use '/path/to/php $piwikHome/console core:archive " . implode(' ', $_SERVER['argv']) . "' instead.
|
||||
To get help use '/path/to/php $piwikHome/console core:archive --help'
|
||||
See also: https://matomo.org/docs/setup-auto-archiving/
|
||||
|
||||
If you cannot use the console because it requires CLI
|
||||
try 'php archive.php --url=http://your.piwik/path'
|
||||
-------------------------------------------------------
|
||||
\n\n";
|
||||
|
||||
array_unshift($_SERVER['argv'], 'core:archive');
|
||||
array_unshift($_SERVER['argv'], $script);
|
||||
|
||||
$console->run();
|
||||
} else { // if running via web request, use CoreAdminHome.runCronArchiving method
|
||||
Piwik\Common::sendHeader('Content-type: text/plain');
|
||||
$_GET['module'] = 'API';
|
||||
$_GET['method'] = 'CoreAdminHome.runCronArchiving';
|
||||
$_GET['format'] = 'console'; // will use Content-type text/plain
|
||||
|
||||
if(!isset($_GET['token_auth'])) {
|
||||
echo "
|
||||
<b>You must specify the Super User token_auth as a parameter to this script, eg. <code>?token_auth=XYZ</code> if you wish to run this script through the browser. </b><br>
|
||||
However it is recommended to run it <a href='https://matomo.org/docs/setup-auto-archiving/'>via cron in the command line</a>, since it can take a long time to run.<br/>
|
||||
In a shell, execute for example the following to trigger archiving on the local Piwik server:<br/>
|
||||
<code>$ /path/to/php /path/to/piwik/console core:archive --url=http://your-website.org/path/to/piwik/</code>
|
||||
\n\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once PIWIK_INCLUDE_PATH . "/index.php";
|
||||
}
|
43
msd2/tracking/piwik/misc/cron/archive.sh
Normal file
43
msd2/tracking/piwik/misc/cron/archive.sh
Normal file
@ -0,0 +1,43 @@
|
||||
#!/bin/sh -e
|
||||
# =======================================================================
|
||||
# WARNING: this script archive.sh is DEPRECATED!
|
||||
#
|
||||
# => Replace your cron with `/usr/bin/php5 /path/to/piwik/console core:archive --url=http://example.org/piwik/`
|
||||
#
|
||||
# See documentation at https://piwik.org/setup-auto-archiving/
|
||||
# =======================================================================
|
||||
|
||||
for TEST_PHP_BIN in php5 php php-cli php-cgi; do
|
||||
if which $TEST_PHP_BIN >/dev/null 2>/dev/null; then
|
||||
PHP_BIN=`which $TEST_PHP_BIN`
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if test -z $PHP_BIN; then
|
||||
echo "php binary not found. Make sure php5 or php exists in PATH." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
act_path() {
|
||||
local pathname="$1"
|
||||
readlink -f "$pathname" 2>/dev/null || \
|
||||
realpath "$pathname" 2>/dev/null || \
|
||||
type -P "$pathname" 2>/dev/null
|
||||
}
|
||||
|
||||
ARCHIVE=`act_path ${0}`
|
||||
PIWIK_CRON_FOLDER=`dirname ${ARCHIVE}`
|
||||
PIWIK_PATH="$PIWIK_CRON_FOLDER"/../../console
|
||||
|
||||
CONSOLE_CMD="$PHP_BIN -q $PIWIK_PATH core:archive --url=http://example.org"
|
||||
|
||||
MESSAGE="\n\n WARNING: this script archive.sh is DEPRECATED! \n\nPlease update your cron as explained in the documentation: https://matomo.org/docs/setup-auto-archiving/ \n\n"
|
||||
|
||||
echo $MESSAGE;
|
||||
|
||||
$CONSOLE_CMD
|
||||
|
||||
echo $MESSAGE;
|
||||
|
||||
exit 1
|
72
msd2/tracking/piwik/misc/cron/updatetoken.php
Normal file
72
msd2/tracking/piwik/misc/cron/updatetoken.php
Normal file
@ -0,0 +1,72 @@
|
||||
<?php
|
||||
/**
|
||||
* Piwik - free/libre analytics platform
|
||||
*
|
||||
* @link http://piwik.org
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
|
||||
*
|
||||
* @category Piwik
|
||||
* @package Piwik
|
||||
*/
|
||||
|
||||
namespace Piwik;
|
||||
|
||||
use Piwik\Application\Environment;
|
||||
use Piwik\Tests\Framework\TestingEnvironmentManipulator;
|
||||
use Piwik\Tests\Framework\TestingEnvironmentVariables;
|
||||
|
||||
if (!defined('PIWIK_INCLUDE_PATH')) {
|
||||
define('PIWIK_INCLUDE_PATH', realpath(dirname(__FILE__) . "/../.."));
|
||||
}
|
||||
|
||||
if (!defined('PIWIK_USER_PATH')) {
|
||||
define('PIWIK_USER_PATH', PIWIK_INCLUDE_PATH);
|
||||
}
|
||||
|
||||
define('PIWIK_ENABLE_DISPATCH', false);
|
||||
define('PIWIK_ENABLE_ERROR_HANDLER', false);
|
||||
define('PIWIK_ENABLE_SESSION_START', false);
|
||||
|
||||
require_once PIWIK_INCLUDE_PATH . "/index.php";
|
||||
|
||||
if (!Common::isPhpCliMode()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$testmode = in_array('--testmode', $_SERVER['argv']);
|
||||
if ($testmode) {
|
||||
define('PIWIK_TEST_MODE', true);
|
||||
|
||||
Environment::setGlobalEnvironmentManipulator(new TestingEnvironmentManipulator(new TestingEnvironmentVariables()));
|
||||
}
|
||||
|
||||
function getPiwikDomain()
|
||||
{
|
||||
foreach($_SERVER['argv'] as $param) {
|
||||
$pattern = '--matomo-domain=';
|
||||
if(false !== strpos($param, $pattern)) {
|
||||
return substr($param, strlen($pattern));
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
$piwikDomain = getPiwikDomain();
|
||||
if($piwikDomain) {
|
||||
Url::setHost($piwikDomain);
|
||||
}
|
||||
|
||||
$environment = new Environment('cli');
|
||||
$environment->init();
|
||||
|
||||
$token = Db::get()->fetchOne("SELECT token_auth
|
||||
FROM " . Common::prefixTable("user") . "
|
||||
WHERE superuser_access = 1
|
||||
ORDER BY date_registered ASC");
|
||||
|
||||
$filename = $environment->getContainer()->get('path.tmp') . '/cache/token.php';
|
||||
|
||||
$content = "<?php exit; //\t" . $token;
|
||||
file_put_contents($filename, $content);
|
||||
echo $filename;
|
Reference in New Issue
Block a user