Example #1
0
<?php

require_once realpath(dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'indexer.php');
use nzedb\ReleaseSearch;
use nzedb\db\DB;
if (!isset($argv[1]) || !in_array($argv[1], ['sphinx', 'standard'])) {
    exit('Argument1 (required) is the method of search you would like to optimize for.  Choices are sphinx or standard.' . PHP_EOL . 'Argument2 (optional) is the storage engine and row_format you would like the release_search_data table to use. If not entered it will be left default.' . PHP_EOL . 'Choices are (c|d)(myisam|innodb) (Compressed|Dynamic)(MyISAM|InnoDB) entered like dinnodb.  This argument has no effect if optimizinf for Sphinx.' . PHP_EOL . 'Please stop all processing scripts before running this script.' . PHP_EOL);
}
switch ($argv[1]) {
    case 'sphinx':
        if (nZEDb_RELEASE_SEARCH_TYPE == ReleaseSearch::SPHINX) {
            optimizeForSphinx(new DB());
        } else {
            echo PHP_EOL . $pdo->log->error('Error, nZEDb_RELEASE_SEARCH_TYPE in www/settings.php must be set to SPHINX to optimize for Sphinx!' . PHP_EOL);
        }
        break;
    case 'standard':
        revertToStandard(new DB());
        break;
}
// Optimize database usage for Sphinx full-text
function optimizeForSphinx($pdo)
{
    echo PHP_EOL . $pdo->log->info('Dropping search triggers to save CPU and lower QPS. (Quick)' . PHP_EOL);
    dropSearchTriggers($pdo);
    echo $pdo->log->info('Truncating release_search_data table to free up memory pools/buffers.  (Quick)' . PHP_EOL);
    $pdo->queryExec('TRUNCATE TABLE release_search_data');
    echo $pdo->log->header('Optimization for Sphinx process complete!' . PHP_EOL);
}
//Revert database to standard schema
function revertToStandard($pdo)
Example #2
0
<?php

require dirname(__FILE__) . '/../../www/config.php';
if (!isset($argv[1]) || !in_array($argv[1], ['sphinx', 'standard'])) {
    exit('Argument1 (required) is the method of search you would like to optimize for.  Choices are sphinx or standard.' . PHP_EOL . 'Argument2 (optional) is the storage engine and row_format you would like the releasesearch table to use. If not entered it will be left default.' . PHP_EOL . 'Choices are (c|d)(myisam|innodb) (Compressed|Dynamic)(MyISAM|InnoDB) entered like dinnodb.  This argument has no effect if optimizinf for Sphinx.' . PHP_EOL . 'Please stop all processing scripts before running this script.' . PHP_EOL);
}
switch ($argv[1]) {
    case 'sphinx':
        if (nZEDb_RELEASE_SEARCH_TYPE == ReleaseSearch::SPHINX) {
            optimizeForSphinx(new nzedb\db\DB());
        } else {
            echo PHP_EOL . $pdo->log->error('Error, nZEDb_RELEASE_SEARCH_TYPE in www/settings.php must be set to SPHINX to optimize for Sphinx!' . PHP_EOL);
        }
        break;
    case 'standard':
        revertToStandard(new nzedb\db\DB());
        break;
}
// Optimize database usage for Sphinx full-text
function optimizeForSphinx($pdo)
{
    echo PHP_EOL . $pdo->log->info('Dropping search triggers to save CPU and lower QPS. (Quick)' . PHP_EOL);
    dropSearchTriggers($pdo);
    echo $pdo->log->info('Truncating releasesearch table to free up memory pools/buffers.  (Quick)' . PHP_EOL);
    $pdo->queryExec('TRUNCATE TABLE releasesearch');
    echo $pdo->log->header('Optimization for Sphinx process complete!' . PHP_EOL);
}
//Revert database to standard schema
function revertToStandard($pdo)
{
    $engFormat = '';
<?php

require_once dirname(__FILE__) . '/../../www/config.php';
use newznab\db\Settings;
if (!isset($argv[1]) || !in_array($argv[1], ['sphinx', 'standard'])) {
    exit('Argument1 (required) is the method of search you would like to optimize for.  Choices are sphinx or standard.' . PHP_EOL . 'Argument2 (optional) is the storage engine and row_format you would like the releasesearch table to use. If not entered it will be left default.' . PHP_EOL . 'Choices are (c|d)(myisam|innodb) (Compressed|Dynamic)(MyISAM|InnoDB) entered like dinnodb.  This argument has no effect if optimizinf for Sphinx.' . PHP_EOL . 'Please stop all processing scripts before running this script.' . PHP_EOL);
}
switch ($argv[1]) {
    case 'sphinx':
        if (NN_RELEASE_SEARCH_TYPE == \ReleaseSearch::SPHINX) {
            optimizeForSphinx(new Settings());
        } else {
            echo PHP_EOL . $pdo->log->error('Error, NN_RELEASE_SEARCH_TYPE in www/settings.php must be set to SPHINX to optimize for Sphinx!' . PHP_EOL);
        }
        break;
    case 'standard':
        revertToStandard(new Settings());
        break;
}
// Optimize database usage for Sphinx full-text
function optimizeForSphinx($pdo)
{
    echo PHP_EOL . $pdo->log->info('Dropping search triggers to save CPU and lower QPS. (Quick)' . PHP_EOL);
    dropSearchTriggers($pdo);
    echo $pdo->log->info('Truncating releasesearch table to free up memory pools/buffers.  (Quick)' . PHP_EOL);
    $pdo->queryExec('TRUNCATE TABLE releasesearch');
    echo $pdo->log->header('Optimization for Sphinx process complete!' . PHP_EOL);
}
//Revert database to standard schema
function revertToStandard($pdo)
{