예제 #1
0
파일: sfPakeDev.php 프로젝트: kotow/work
function run_dt($task, $args)
{
    ini_set("memory_limit", "1024M");
    ini_set("display_errors", 1);
    define('SF_ROOT_DIR', sfConfig::get('sf_root_dir'));
    define('SF_APP', 'frontend');
    define('SF_ENVIRONMENT', 'prod');
    define('SF_DEBUG', true);
    require_once SF_ROOT_DIR . DIRECTORY_SEPARATOR . 'apps' . DIRECTORY_SEPARATOR . SF_APP . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.php';
    $databaseManager = new sfDatabaseManager();
    $databaseManager->initialize();
    sfConfig::set('sf_cache_objects', false);
    sfConfig::set('sf_cache_relations', false);
    sfConfig::set('sf_use_relations_cache', false);
    $c = new Criteria();
    $c->add(TrademarkPeer::FROM_SYSTEM, 3);
    $imports = TrademarkPeer::doSelect($c);
    $i = 0;
    foreach ($imports as $import) {
        $i++;
        $import->delete();
        echo ".";
    }
    sfConfig::set('sf_cache_objects', true);
    sfConfig::set('sf_cache_relations', true);
    sfConfig::set('sf_use_relations_cache', true);
    exit(">>" . $i . "\n");
}
예제 #2
0
 public function executeUploadTrademarks()
 {
     $this->setLayout(false);
     if ($addPage = Document::getDocumentByExclusiveTag('website_page_add_new_trademark')) {
         $this->addTrademarkURL = $addPage->getHref();
     } else {
         $this->addTrademarkURL = '#';
     }
     $c = new Criteria();
     $c->addDescendingOrderByColumn(TrademarkPeer::ID);
     $cr1 = $c->getNewCriterion(TrademarkPeer::FROM_SYSTEM, 1);
     $cr2 = $c->getNewCriterion(TrademarkPeer::FROM_SYSTEM, 11);
     $cr1->addOr($cr2);
     $c->add($cr1);
     $importsArr[1] = TrademarkPeer::doSelect($c);
     $c = new Criteria();
     $c->addDescendingOrderByColumn(ImportPeer::ID);
     $c->add(ImportPeer::SYSTEM, 2);
     $importsArr[2] = ImportPeer::doSelect($c);
     $c = new Criteria();
     $c->addDescendingOrderByColumn(ImportPeer::ID);
     $c->add(ImportPeer::SYSTEM, 3);
     $importsArr[3] = ImportPeer::doSelect($c);
     $this->importsArr = $importsArr;
     $this->statusColors = array('new' => '#202080', 'imported' => '#208010', 'error' => '#802020');
     $this->reload = 0;
     if ($reload = $this->getRequestParameter('reload')) {
         $this->reload = $reload;
     }
 }
예제 #3
0
파일: sfPakeImport.php 프로젝트: kotow/work
function run_create_session($task, $args)
{
    ini_set("memory_limit", "2048M");
    ini_set("display_errors", 1);
    define('SF_ROOT_DIR', sfConfig::get('sf_root_dir'));
    define('SF_APP', 'frontend');
    define('SF_ENVIRONMENT', 'prod');
    define('SF_DEBUG', true);
    require_once SF_ROOT_DIR . DIRECTORY_SEPARATOR . 'apps' . DIRECTORY_SEPARATOR . SF_APP . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.php';
    $databaseManager = new sfDatabaseManager();
    $databaseManager->initialize();
    $ds = DIRECTORY_SEPARATOR;
    $root = sfConfig::get('sf_root_dir') . $ds . sfConfig::get('sf_web_dir_name') . $ds . "uploads" . $ds;
    _echo_cms_title('CREATE-SESSION');
    sfConfig::set('sf_cache_objects', false);
    sfConfig::set('sf_cache_relations', false);
    sfConfig::set('sf_use_relations_cache', false);
    $c = new Criteria();
    $c->add(TrademarkPeer::FROM_SYSTEM, 1);
    $c->addAscendingOrderByColumn(TrademarkPeer::ID);
    $trademarks = TrademarkPeer::doSelect($c);
    //var_dump(count($trademarks));
    if ($trademarks) {
        $start = $trademarks[0]->getId();
        $count = count($trademarks);
        foreach ($trademarks as $trademark) {
            $trademark->setFromSystem(11);
            $trademark->save();
        }
        $is = new ImportSession();
        $is->setLabel(date('d.m.Y H:i'));
        $is->setStartId($start);
        $is->setTmCount($count);
        $is->save();
    }
}
예제 #4
0
 public static function retrieveByPKs($pks, $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(self::DATABASE_NAME);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria();
         $criteria->add(TrademarkPeer::ID, $pks, Criteria::IN);
         $objs = TrademarkPeer::doSelect($criteria, $con);
     }
     return $objs;
 }