Example #1
0
# if
# We vragen de nntp_hdr settings alvast op
$settings_nntp_hdr = $settings->get('nntp_hdr');
if (empty($settings_nntp_hdr['host'])) {
    die("Unable to continue: You did not setup any newsserver yet." . PHP_EOL);
}
# if
## Als we forceren om de "already running" check te bypassen, doe dat dan
if (SpotCommandline::get('force')) {
    $db->setRetrieverRunning($settings_nntp_hdr['host'], false);
}
# if
## Moeten we debugloggen? Kan alleen als geen --force opgegeven wordt
$debugLog = SpotCommandline::get('debug');
## RETRO MODE! Hiermee kunnen we de fullspots, fullcomments en/of cache achteraf ophalen
$retroMode = SpotCommandline::get('retro');
/*
 * Retention cleanup. Basically when we ask for Spotweb to only
 * keep spots for 'xx' days (eg: 30 days), we either have to delete
 * everyting older than 'xx' days, or delete all 'full' resources
 * older than the specified time period.
 *
 * The full resources are everything beyond the bare minimum to 
 * display the spots, so we delete nzb's, images, comments, etc.
 */
try {
    if ($settings->get('retention') > 0 && !$retroMode) {
        if ($settings->get('retentiontype') == 'everything') {
            $db->deleteSpotsRetention($settings->get('retention'));
        } elseif ($settings->get('retentiontype') == 'fullonly') {
            $db->expireCache($settings->get('retention'));
Example #2
0
 public static function initialize($noopt, $defaults)
 {
     self::$_parsed = self::parseParameters($noopt);
     self::$_defaults = $defaults;
 }
Example #3
0
        echo "Reset security groups to their default settings done" . PHP_EOL;
    }
    # if
    /* 
     * If the user asked to reset group membership, reset all group memberships.
     */
    if (SpotCommandline::get('reset-groupmembership')) {
        echo "Resetting users' group membeship to the default" . PHP_EOL;
        $svcUpgradeBase->resetUserGroupMembership();
        echo "Reset of users' group membership done" . PHP_EOL;
    }
    # if
    /* 
     * If the user asked to reset filters, do so
     */
    if (SpotCommandline::get('reset-filters')) {
        echo "Resetting users' filters to the default" . PHP_EOL;
        $svcUpgradeBase->resetFilters();
        echo "Reset of users' filters done" . PHP_EOL;
    }
    # if
    echo "Performing basic analysis of database tables" . PHP_EOL;
    $svcUpgradeBase->analyze($settings);
    echo "Basic database optimalisation done" . PHP_EOL;
} catch (CacheMustBeMigratedException $x) {
    die("Your current Spotweb installation has an old way of storing Spotweb related files like images and NZB files. " . PHP_EOL . "We provide the script 'migrate-cache.php' to migrate the cache without losing your data. Depending on the " . PHP_EOL . "size of your cache this can take a very long time." . PHP_EOL . PHP_EOL . "Please run the 'migrate-cache.php' script because attempting to run 'upgrade-db.php' again will erase your cache completely" . PHP_EOL);
} catch (CacheMustBeMigrated2Exception $x) {
    die("Apologies for the inconvience, but Spotweb has once again changed the way we store files for cache. This " . PHP_EOL . "means you need to run the script 'migrate-cache2.php' again.  " . PHP_EOL . "Depending on the size of your cache this can take a very long time." . PHP_EOL . PHP_EOL . "Please run the 'migrate-cache.php2' script again");
} catch (SpotwebCannotBeUpgradedToooldException $x) {
    die("Your current Spotweb installation is too old to be upgraded to this current version of Spotweb. " . PHP_EOL . "Please download an earlier version of Spotweb (https://github.com/spotweb/spotweb/zipball/" . $x->getMessage() . "), " . PHP_EOL . "run upgrade-db.php using that version and then upgrade back to this version to run upgrade-db.php once more.");
} catch (InvalidOwnSettingsSettingException $x) {
     chdir(dirname(__FILE__));
 }
 # if
 require_once "lib/SpotClassAutoload.php";
 SpotClassAutoload::register();
 require_once "lib/Bootstrap.php";
 /*
  * Create a DAO factory. We cannot use the bootstrapper here,
  * because it validates for a valid settings etc. version.
  */
 $bootstrap = new Bootstrap();
 list($settings, $daoFactory, $req) = $bootstrap->boot();
 # Initialize commandline arguments
 SpotCommandline::initialize(array('clean'), array('clean' => false));
 # Truncate the current collections tables, and reset all collection id's
 if (SpotCommandline::get('clean')) {
     $dbConnection = $daoFactory->getConnection();
     echo "Cleaning up all existing collections, ";
     $dbConnection->rawExec('UPDATE spots SET collectionid = NULL WHERE collectionid IS NOT NULL');
     $dbConnection->rawExec('TRUNCATE collections');
     $dbConnection->rawExec('TRUNCATE mastercollections');
     echo "done." . PHP_EOL;
 }
 // if
 /* Load the complete collection cache in memory */
 echo "Loading all existing collections in memory, ";
 $daoFactory->getCollectionsDao()->loadCollectionCache(array());
 echo "done" . PHP_EOL;
 /* And start creating ocllections */
 $svcCreateColl = new Services_Collections_Create($daoFactory);
 $svcCreateColl->createCollections(0, 'displayProgress');