All pastes #455805 Raw Edit

Miscellany

public php v1 · immutable
#455805 ·published 2007-04-24 13:52 UTC
rendered paste body
#!/usr/bin/env php<?php//////////////////////////////////////////////////////////////////////////////// Terminate immediately unless invoked as a command line scriptif (!empty($_SERVER['REQUEST_METHOD']))  die();exit(main($GLOBALS['argc'], $GLOBALS['argv']));//////////////////////////////////////////////////////////////////////////////function main($argc, $argv) {        $_SERVER['HTTP_HOST'] = $argv[1];        $_SERVER['PHP_SELF'] = '/index.php';        include_once './includes/bootstrap.inc';        drupal_bootstrap(DRUPAL_BOOTSTRAP_PATH);        define('G2PATH', variable_get('g2themesync_g2path','/'));        include_once(G2PATH . 'embed.php');        echo "\n";        echo G2PATH . 'embed.php';        $ret = GalleryEmbed::init(array('fullInit' => 'true'));        list($ret, $albumIds) = GalleryCoreApi::fetchAllItemIds('GalleryAlbumItem');        list($ret, $albums) = GalleryCoreApi::loadEntitiesById($albumIds);        list($ret, $singleLockId) = GalleryCoreApi::acquireWriteLock($albumIds);        foreach ($albums as $album) {                echo '.';                $album->setTheme($argv[2]);                $album->save();        }        list($ret, $relLockId) = GalleryCoreApi::releaseLocks($singleLockId);        $ret = GalleryCoreApi::setPluginParameter('module', 'core', 'default.theme', $argv[2]);        $ret = GalleryEmbed::done();        echo "\n";}