} // ----- only run from command line ----- if (!env_is_cli()) { die; } // ----- params ----- set_time_limit(0); error_reporting(E_ALL); define('CAPTURE', 'onepercent'); // ----- includes ----- include "../../config.php"; // load base config file include "../../common/functions.php"; // load base functions file include "../common/functions.php"; // load capture function file require BASE_FILE . 'capture/common/tmhOAuth/tmhOAuth.php'; $thislockfp = script_lock(CAPTURE); if (!is_resource($thislockfp)) { logit(CAPTURE . ".error.log", "script invoked but will not continue because a process is already holding the lock file."); die; // avoid double execution of script } if (dbserver_has_utf8mb4_support() == false) { logit(CAPTURE . ".error.log", "DMI-TCAT requires at least MySQL version 5.5.3 - please upgrade your server"); exit; } // ----- connection ----- dbconnect(); // connect to database @todo, rewrite mysql calls with pdo tracker_run();
<?php if ($argc < 1) { die; } // only run from command line // ----- params ----- set_time_limit(0); error_reporting(E_ALL); include_once "../../config.php"; include_once BASE_FILE . '/common/functions.php'; include_once BASE_FILE . '/capture/common/functions.php'; require BASE_FILE . 'capture/common/tmhOAuth/tmhOAuth.php'; // make sure only one search script is running $thislockfp = script_lock('search'); if (!is_resource($thislockfp)) { logit("cli", "search.php is already running (maybe through cron?). exiting now."); exit; } // DEFINE SEARCH PARAMETERS HERE $cronjob = false; // set to true, if running from cron $bin_name = ''; // name of the bin $keywords = ''; // separate keywords by 'OR', limit your search to 10 keywords and operators, max 500 characters - https://dev.twitter.com/docs/using-search $type = 'search'; // specify 'search' if you want this to be a standalone bin, or 'track' if you want to be able to continue tracking these keywords later on via BASE_URL/capture/index.php if (empty($bin_name)) { die("bin_name not set\n"); }
} } } } if (!$running) { if (script_lock($role, true) === true) { logit("controller.log", "script {$role} was not running - starting"); // record confirmed gap if we could measure it if ($last) { gap_record($role, $last, time()); } // a forked process may inherit our lock, but we prevent this. flock($thislockfp, LOCK_UN); fclose($thislockfp); passthru(PHP_CLI . " " . BASE_FILE . "capture/stream/dmitcat_{$role}.php > /dev/null 2>&1 &"); $thislockfp = script_lock('controller'); } } } function read_procfile($filename) { $procfile = array(); $n = 0; for (;;) { $contents = file_get_contents($filename); if (isset($contents) && strlen($contents) > 0) { $tmp = explode("|", $contents); $procfile['pid'] = $tmp[0]; $procfile['last'] = $tmp[1]; break; }
* therefore we need to check for more than just length. Here we update everything with length >= 140 and ending with '...' */ $fixer = "update {$bin}" . "_tweets A inner join " . $bin . "_tweets B on A.retweet_id = B.id set A.text = CONCAT('RT @', B.from_user_name, ': ', B.text) where (length(A.text) >= 140 and A.text like '%…') or substr(A.text, position('@' in A.text) + 1, position(': ' in A.text) - 5) != B.from_user_name"; $rec = $dbh->prepare($fixer); $rec->execute(); } } } } // End of upgrades if ($dry_run) { return array('suggested' => $suggested, 'required' => $required); } } if (php_sapi_name() == 'cli' || php_sapi_name() == 'cgi-fcgi') { // make sure only one upgrade script is running $thislockfp = script_lock('upgrade'); if (!is_resource($thislockfp)) { logit("cli", "upgrade.php already running, skipping this check"); exit; } $interactive = true; $aulevel = 0; $single = null; if ($argc > 1) { for ($a = 1; $a < $argc; $a++) { if ($argv[$a] == '--non-interactive') { $interactive = false; } elseif ($argv[$a] == '--au0') { $aulevel = 0; } elseif ($argv[$a] == '--au1') { $aulevel = 1;