You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ require_once __DIR__ . '/../indexer/jobs_interface.php'; define('METHOD_ADD_QUERY', 'add_query'); define('METHOD_SET_INPUT', 'queryText'); // Special: Add To Workers: used by ajax to add a query to the workers if (isset($_GET[METHOD_ADD_QUERY])) { $query = $_GET[METHOD_ADD_QUERY]; work_queueForWorkers([$query], true); // the following content will be returned to the Ajax call die('added.'); } $startInputValue = isset($_GET[METHOD_SET_INPUT]) ? $_GET[METHOD_SET_INPUT] : ''; // Statistics $stats = work_admin_getStats(); $queriesQueue = $stats['queued contents']; $activeWorkers = $stats['workers active']; $maxWorkers = $stats['workers max']; $online = $stats['workers enabled']; $uniqueQueries = $stats['unique queries']; $recentQueue = $stats['recent contents']; // to see all use '?raw' $isAdmin = isset($_GET['raw']) || isset($_GET['xxx']); if (!$isAdmin) {
limitations under the License. */ require_once 'jobs_interface.php'; if (!isset($argv) || sizeof($argv) < 2) { die("We require at least one command line argument:\n" . " add some_query adds the query to the jobs schedule (e.g., literally: \"\\\"that's what she said\\\",cc\")\n" . " status shows the status of the jobs\n" . " clear resets the workers to 0 (but does NOT kill any running worker!)\n" . "\n"); } // handle operations $count = sizeof($argv); switch ($argv[1]) { case 'a': case 'add': if ($count < 3) { die("for 'add', we need which string to add. double-quoted and with double-quotes slashed.\n"); } $query = $argv[2]; echo "adding: [ '" . $query . "' ] to the index... "; echo work_queueForWorkers([$query], true) ? "ok\n" : "ERROR\n"; break; case 's': case 'status': break; case 'c': case 'clear': die("WARNING: re-execute the script with 'reallyclear', but be sure to stop all PHP workers before!\n"); case 'rc': case 'reallyclear': work_admin_reset_DoNotUse($count == 3 && $argv[2] == 'all'); break; default: die("unknown command " . $argv[1] . "\n"); } // show status at the end of many commands