• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP sfDatabaseManager类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中sfDatabaseManager的典型用法代码示例。如果您正苦于以下问题:PHP sfDatabaseManager类的具体用法?PHP sfDatabaseManager怎么用?PHP sfDatabaseManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了sfDatabaseManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: execute

 protected function execute($arguments = array(), $options = array())
 {
     $databaseManager = new sfDatabaseManager($this->configuration);
     $connection = $databaseManager->getDatabase($options['connection'])->getConnection();
     $visiteurs_dir = sfConfig::get('sf_root_dir') . '/web/visiteur/';
     $interactifs_dir = sfConfig::get('sf_root_dir') . '/web/interactif';
     $finder = new sfFinder();
     $fileSystem = new sfFilesystem();
     foreach ($finder->in($visiteurs_dir) as $file) {
         //echo 'search in '. $file;
         if (is_file($file) && basename($file) != '.DS_Store') {
             $realpath = str_replace($visiteurs_dir, "", $file);
             $split = explode('/', $realpath);
             if (count($split) > 2) {
                 //print_r($split);
                 //exit;
                 $visiteur_id = $split[0];
                 $interactif_id = $split[1];
                 $filename = basename($file);
                 //  check if symlink exist
                 if (Doctrine::getTable('Interactif')->symlinkDocument($interactif_id, $visiteur_id, $filename, $file)) {
                     $this->logSection("INFO", "Symlink " . $interactifs_dir . '/' . $interactif_id . '/' . $visiteur_id . '/' . $filename);
                 }
             }
         }
     }
     $this->logSection("INFO", "END Symlink interactif directory");
 }
开发者ID:pmoutet,项目名称:navinum,代码行数:28,代码来源:symlinkVisiteursDocumentsToInteractifsTask.class.php


示例2: execute

 protected function execute($arguments = array(), $options = array())
 {
     $app = $options['app'];
     $env = $options['env'];
     $this->bootstrapSymfony($app, $env, true);
     // initialize the database connection
     $databaseManager = new sfDatabaseManager($this->configuration);
     $connection = $databaseManager->getDatabase('doctrine')->getConnection();
     $this->logSection('import', 'initializing...');
     $plugins = SymfonyPluginApi::getPlugins();
     $count = 0;
     foreach ($plugins as $plugin) {
         $new = Doctrine::getTable('SymfonyPlugin')->findOneByTitle($plugin['id']);
         // if plugin exists update info.  Otherwise, create it
         if ($new) {
             // Nothing Yet
         } elseif ($plugin['id']) {
             $new = new SymfonyPlugin();
             $new['title'] = (string) $plugin['id'];
             $new['description'] = (string) $plugin->description;
             $new['repository'] = (string) $plugin->scm;
             $new['image'] = (string) $plugin->image;
             $new['homepage'] = (string) $plugin->homepage;
             $new['ticketing'] = (string) $plugin->ticketing;
             $new->saveNoIndex();
             $this->logSection('import', "added '{$new->title}'");
             $count++;
         }
     }
     $this->logSection('import', "Running Lucene Cleanup");
     $this->runLuceneRebuild();
     $this->logSection('import', "Completed.  Added {$count} new plugins(s)");
 }
开发者ID:bshaffer,项目名称:Symplist,代码行数:33,代码来源:importSymfonyPluginsTask.class.php


示例3: execute

 protected function execute($arguments = array(), $options = array())
 {
     // initialize the database connection
     $databaseManager = new sfDatabaseManager($this->configuration);
     $connection = $databaseManager->getDatabase($options['connection'])->getConnection();
     $this->logSection('Create directory', "Visiteur");
     $q = Doctrine_Query::create()->from('Visiteur v');
     $visiteurs = $q->execute();
     foreach ($visiteurs as $visiteur) {
         $visiteur->createDataFolder();
     }
     $this->logSection('Create directory', "Interactif");
     $q = Doctrine_Query::create()->from('Interactif i');
     $interactifs = $q->execute();
     foreach ($interactifs as $interactif) {
         $interactif->createDataFolder();
     }
     $this->logSection('Create directory', "Exposition");
     $q = Doctrine_Query::create()->from('Exposition v');
     $expositions = $q->execute();
     foreach ($expositions as $exposition) {
         $exposition->createDataFolder();
     }
     $this->logSection('Create directory', "Medaille");
     $fileSystem = new sfFilesystem();
     $fileSystem->mkdirs(sfConfig::get('sf_web_dir') . "/medaille");
     $this->logSection('Create directory', "MedailleType");
     $fileSystem = new sfFilesystem();
     $fileSystem->mkdirs(sfConfig::get('sf_web_dir') . "/medaille_type");
 }
开发者ID:pmoutet,项目名称:navinum,代码行数:30,代码来源:createUserMediaTask.class.php


示例4: execute

 protected function execute($arguments = array(), $options = array())
 {
     // initialize the database connection
     $databaseManager = new sfDatabaseManager($this->configuration);
     $connection = $databaseManager->getDatabase($options['connection'] ? $options['connection'] : null)->getConnection();
     $table = Doctrine::getTable('sfGuardUser');
     $users = $table->createQuery('u')->innerJoin('u.Profile p')->execute();
     $first = true;
     foreach ($users as $user) {
         if (preg_match("/[^\\w]/", $user->username)) {
             $user->username = preg_replace("/[^\\w]/", "_", $user->username);
             while ($table->findOneByUsername($user->username)) {
                 $user->username .= rand(0, 9);
                 echo $user->username;
             }
             $user->save();
             $profile->save();
             if ($first) {
                 echo "The following usernames required change, contact them if they are legitimate users and\nlet them know their new username.\n";
                 echo "The report below shows the NEW username only.\n\n";
                 $first = false;
             }
             echo "Username: " . $user->username . ' Fullname: ' . $user->Profile->fullname . ' Email: ' . $user->getEmailAddress() . "\n";
         }
         $profile = $user->getProfile();
         if (preg_match("/[\\<\\>\\&\\|]/", $profile->fullname)) {
             // No need for a big announcement because we don't log in by our full names
             $profile->fullname = preg_replace("/[\\<\\>\\&\\|]/", "_", $profile->fullname);
             $profile->save();
         }
     }
 }
开发者ID:cpf,项目名称:eBot-CSGO-Web,代码行数:32,代码来源:cleanNamesTask.class.php


示例5: execute

 protected function execute($arguments = array(), $options = array())
 {
     if (!$this->safeToRun()) {
         print "Process already running!\n";
         die;
     }
     $timer = sfTimerManager::getTimer('execute');
     $databaseManager = new sfDatabaseManager($this->configuration);
     $databaseManager->initialize($this->configuration);
     //set up index
     $index = EntityTable::getLuceneIndex();
     //delete deleted entities
     $q = LsDoctrineQuery::create()->from('Entity e')->where('e.is_deleted = ?', true)->setHydrationMode(Doctrine::HYDRATE_ARRAY);
     foreach ($q->execute() as $entity) {
         if ($hits = $index->find('key:' . $entity['id'])) {
             if ($options['debug_mode']) {
                 printf("Deleting index for Entity %s\n", $entity['id']);
             }
             foreach ($hits as $hit) {
                 $index->delete($hit->id);
             }
         }
     }
     printf("Memory used: %s\n", LsNumber::makeBytesReadable(memory_get_usage()));
     printf("Index size: %s\n", $index->count());
     $timer->addTime();
     printf("Run time: %s\n", $timer->getElapsedTime());
     sfTimerManager::clearTimers();
 }
开发者ID:silky,项目名称:littlesis,代码行数:29,代码来源:CleanSearchIndexTask.class.php


示例6: execute

 protected function execute($arguments = array(), $options = array())
 {
     // initialize the database connection
     $databaseManager = new sfDatabaseManager($this->configuration);
     $connection = $databaseManager->getDatabase($options['connection'])->getConnection();
     // add your code here
 }
开发者ID:JoshuaEstes,项目名称:sfAmazonPlugin,代码行数:7,代码来源:ec2RebootTask.class.php


示例7: execute

 protected function execute($arguments = array(), $options = array())
 {
     $context = sfContext::createInstance(sfProjectConfiguration::getApplicationConfiguration('app', $options['env'], true));
     parent::execute($arguments, $options);
     // initialize the database connection
     $databaseManager = new sfDatabaseManager($this->configuration);
     $connection = $databaseManager->getDatabase($options['connection'])->getConnection();
     // add your code here
     $options_task_server_backup = array('location' => $arguments['location'], 'filepath' => $arguments['filepath']);
     if ($arguments['snapshot']) {
         $options_task_server_backup['snapshot'] = $arguments['snapshot'];
     }
     if ($arguments['newsnapshot']) {
         $options_task_server_backup['newsnapshot'] = $arguments['newsnapshot'];
     }
     if ($arguments['delete']) {
         $options_task_server_backup['deletesnapshot'] = $arguments['delete'];
     }
     if ($arguments['location']) {
         if ($arguments['do_not_generate_tar'] && $arguments['do_not_generate_tar'] != 'false') {
             $options_task_server_backup['do_not_generate_tar'] = true;
         }
     }
     $task_server_backup = new serverBackupTask($this->dispatcher, new sfFormatter());
     return $task_server_backup->run(array('serverid' => $arguments['serverid']), $options_task_server_backup);
 }
开发者ID:ketheriel,项目名称:ETVA,代码行数:26,代码来源:serverDownloadbackupsnapshotTask.class.php


示例8: execute

 protected function execute($arguments = array(), $options = array())
 {
     // initialize the database connection
     $databaseManager = new sfDatabaseManager($this->configuration);
     $connection = $databaseManager->getDatabase($options['connection'])->getConnection();
     /*
     if($options['include'] != "" && $options['exclude'] != "")
     {
       throw new Exception("Only one option is authorized");
     }
     */
     if ($options['include'] != "") {
         $to_replace = split(",", $options['include']);
         sfConfig::set('app_sync_tables', $to_replace);
     }
     if ($options['exclude'] != "") {
         $tables = sfConfig::get('app_sync_tables');
         $excludes = split(",", $options['exclude']);
         foreach ($excludes as $exclude) {
             if (($key = array_search($exclude, $tables)) !== false) {
                 unset($tables[$key]);
             }
         }
         sfConfig::set('app_sync_tables', $tables);
     }
     $sync = new ServerVipSync($this->configuration);
     $sync->startSync();
 }
开发者ID:pmoutet,项目名称:navinum,代码行数:28,代码来源:syncTask.class.php


示例9: execute

 protected function execute($arguments = array(), $options = array())
 {
     // initialize the database connection
     $databaseManager = new sfDatabaseManager($this->configuration);
     $connection = $databaseManager->getDatabase($options['connection'] ? $options['connection'] : null)->getConnection();
     $MODEL_CLASS_NAME = $arguments['classname'];
     if ('doctrine' === sfConfig::get('sf_orm')) {
         $table = Doctrine_Core::getTable($MODEL_CLASS_NAME);
         $fieldNames = $table->getColumnNames();
         $this->log(sprintf('%s', $MODEL_CLASS_NAME));
         $this->log(sprintf('  %s_data', $MODEL_CLASS_NAME));
         foreach ($fieldNames as $fieldName) {
             $this->log(sprintf('    %-20s %s', $fieldName . ':', $table->getTypeOf($fieldName)));
         }
     } else {
         $MODEL_CLASS_NAME_PEER = $MODEL_CLASS_NAME . 'Peer';
         $peerClass = new $MODEL_CLASS_NAME_PEER();
         $fieldNames = $peer_class->getFieldNames(BasePeer::TYPE_FIELDNAME);
         $this->log(sprintf('%s', $MODEL_CLASS_NAME));
         $this->log(sprintf('  %s_data', $MODEL_CLASS_NAME));
         foreach ($fieldNames as $fieldName) {
             $this->log(sprintf('    %-20s', $fieldName . ':'));
         }
     }
 }
开发者ID:hidenorigoto,项目名称:xnGenerateFixtureTemplateTask,代码行数:25,代码来源:xnGenerateFixtureTemplateTask.class.php


示例10: execute

    protected function execute($arguments = array(), $options = array()) {
        $databaseManager = new sfDatabaseManager($this->configuration);
        $connection = $databaseManager->getDatabase($options['connection'] ? $options['connection'] : null)->getConnection();
        $context = sfContext::createInstance($this->configuration);
        sfProjectConfiguration::getActive()->loadHelpers('Partial', 'I18N', 'Url');
        $serverUrl = $options['setenvironment'] == '' ? $serverUrl = $options['host'] : $serverUrl = $options['host'] . '/' . $options['setenvironment'];
        $workflows = WorkflowVersionTable::instance()->getWorkflowsToStart(time())->toArray();
        foreach($workflows as $workflow) {
            $sender = WorkflowTemplateTable::instance()->getWorkflowTemplateById($workflow['workflowtemplate_id'])->toArray();
            $userSettings = new UserMailSettings($sender[0]['sender_id']);
            $sendMail = new SendStartWorkflowEmail($userSettings, $context, $workflow, $sender, $serverUrl);
            $workflowTemplate = WorkflowTemplateTable::instance()->getWorkflowTemplateByVersionId($workflow['id']);
            WorkflowVersionTable::instance()->startWorkflowInFuture($workflow['id']);
            $sendToAllSlotsAtOnce = $workflowTemplate[0]->getMailinglistVersion()->toArray();
            if($sendToAllSlotsAtOnce[0]['sendtoallslotsatonce'] == 1) {
                $calc = new CreateWorkflow($workflow['id']);
                $calc->setServerUrl($serverUrl);
                $calc->setContext($context);
                $calc->addAllSlots();
            }
            else {
                $calc = new CreateWorkflow($workflow['id']);
                $calc->setServerUrl($serverUrl);
                $calc->setContext($context);
                $calc->addSingleSlot();
            }

        }
  }
开发者ID:rlauenroth,项目名称:cuteflow_v3,代码行数:29,代码来源:startWorkflowTask.class.php


示例11: execute

  protected function execute($arguments = array(), $options = array())
  {
    $databaseManager = new sfDatabaseManager($this->configuration);
    $this->conn = $databaseManager->getDatabase('doctrine')->getDoctrineConnection();

    $sql = 'SELECT id FROM community';
    $where = array();
    if ( $options['cmin'] && $options['cmax']  && $options['cmin'] <= $options['cmax'])
    {
        $sql .= ' WHERE id BETWEEN ? AND ?';
        $where = array(intval($options['cmin']),intval($options['cmax']));
    }
    $commuIds = $this->conn->fetchColumn($sql, $where);
    foreach ($commuIds as $cid)
    {
      for ($i=0; $i < $options['number']; ++$i)
      {
        $ct = new CommunityTopic();
        $ct->setCommunity(Doctrine::getTable('community')->find($cid));
        $ct->setMemberId(self::fetchRandomMemberId($cid));
        $ct->setName('name');
        $ct->setBody('body');
        $ct->save();
        $ct->free();
        $this->logSection('created a community topic', sprintf("%s", $cid));
      }
    }
  }
开发者ID:nise-nabe,项目名称:opKdtPlugin,代码行数:28,代码来源:opKdtGenerateCommunityTopicTask.class.php


示例12: execute

 /**
  * DOCUMENT ME
  * @param mixed $arguments
  * @param mixed $options
  */
 protected function execute($arguments = array(), $options = array())
 {
     // initialize the database connection
     $databaseManager = new sfDatabaseManager($this->configuration);
     $connection = $databaseManager->getDatabase($options['connection'] ? $options['connection'] : null)->getConnection();
     // PDO connection not so useful, get the doctrine one
     $conn = Doctrine_Manager::connection();
     if ($options['table'] === 'aPage') {
         $q = Doctrine::getTable('aLuceneUpdate')->createQuery('u');
     } else {
         $q = Doctrine::getTable($options['table'])->createQuery('o')->where('o.lucene_dirty IS TRUE');
     }
     if ($options['limit'] !== false) {
         $q->limit($options['limit'] + 0);
     }
     $updates = $q->execute();
     $i = 0;
     foreach ($updates as $update) {
         $i++;
         if ($options['table'] === 'aPage') {
             $page = aPageTable::retrieveByIdWithSlots($update->page_id, $update->culture);
             // Careful, pages die
             if ($page) {
                 $page->updateLuceneIndex();
             }
             $update->delete();
         } else {
             // The actual object
             $update->updateLuceneIndex();
             $update->lucene_dirty = false;
             $update->save();
         }
     }
 }
开发者ID:hashir,项目名称:UoA,代码行数:39,代码来源:updateluceneTask.class.php


示例13: execute

 protected function execute($arguments = array(), $options = array())
 {
     $configuration = ProjectConfiguration::getApplicationConfiguration($arguments['application'], $options['env'], true);
     $databaseManager = new sfDatabaseManager($configuration);
     $databaseManager->initialize($configuration);
     $this->db = Doctrine_Manager::connection();
     if ($options['house_senate'] == 'house') {
         $sql = 'select e1.id,e2.id from entity e1 left join political_candidate pc on pc.entity_id = e1.id left join political_candidate pc2 on pc2.house_fec_id = pc.house_fec_id left join entity e2 on e2.id = pc2.entity_id where e1.is_deleted = 0 and e2.is_deleted = 0 and e1.id <> e2.id and pc.id is not null and pc2.id is not null and pc.id <> pc2.id and pc.house_fec_id is not null and pc.house_fec_id <> "" and e1.id < e2.id group by e1.id,e2.id';
     } else {
         if ($options['house_senate'] == 'senate') {
             $sql = 'select e1.id,e2.id from entity e1 left join political_candidate pc on pc.entity_id = e1.id left join political_candidate pc2 on pc2.senate_fec_id = pc.senate_fec_id left join entity e2 on e2.id = pc2.entity_id where e1.is_deleted = 0 and e2.is_deleted = 0 and e1.id <> e2.id and pc.id is not null and pc2.id is not null and pc.id <> pc2.id and pc.senate_fec_id is not null and pc.senate_fec_id <> "" and e1.id < e2.id group by e1.id,e2.id';
         } else {
             echo 'House or Senate not selected...ending script' . "\n";
             die;
         }
     }
     $stmt = $this->db->execute($sql);
     $rows = $stmt->fetchAll();
     foreach ($rows as $row) {
         $e1 = Doctrine::getTable('Entity')->find($row[0]);
         $e2 = Doctrine::getTable('Entity')->find($row[1]);
         $mergedEntity = EntityTable::mergeAll($e1, $e2);
         $e2->setMerge(true);
         $e2->clearRelated();
         $e2->delete();
         echo '  Successfully merged ' . $e2->name . "\n";
         if ($options['test_mode']) {
             die;
         }
     }
 }
开发者ID:silky,项目名称:littlesis,代码行数:31,代码来源:mergePoliticalDuplicatesTask.class.php


示例14: execute

  protected function execute($arguments = array(), $options = array())
  {
    $databaseManager = new sfDatabaseManager($this->configuration);
    $this->conn = $databaseManager->getDatabase('doctrine')->getDoctrineConnection();

    $communityIds = $this->getCommunityIds();
    for ($i=0; $i < $options['communitynumber']; ++$i)
    {
      $communityId = $this->fetchRandomCommunityId($communityIds);
      $topicIds = $this->getTopicIds($communityId);
      $memberIds = $this->getMemberIds($communityId);
      for ($j=0; $j < $options['topicnumber']; ++$j)
      {
        for ($k=0; $k < $options['number']; ++$k)
        {
          $ctc = new CommunityTopicComment();
          $ctc->setMemberId(self::fetchRandomMemberId($memberIds));
          $ctc->setCommunityTopicId(self::fetchRandomTopicId($topicIds));
          $ctc->setBody('body');
          $ctc->save();
          $ctc->free();
          $this->logSection('created a community topic comment', sprintf("%s", $communityId));
        }
      }
    }
  }
开发者ID:nise-nabe,项目名称:opKdtPlugin,代码行数:26,代码来源:opKdtGenerateCommunityTopicCommentTask.class.php


示例15: execute

 /**
  * @param   array   $arguments    (optional)
  * @param   array   $options      (optional)
  */
 public function execute($arguments = array(), $options = array())
 {
     $databaseManager = new sfDatabaseManager($this->configuration);
     $connection = $databaseManager->getDatabase($options['connection'] ? $options['connection'] : null)->getConnection();
     afPortalStatePeer::deleteAllByIdXml($arguments['idxml']);
     return 0;
 }
开发者ID:cbsistem,项目名称:appflower_engine,代码行数:11,代码来源:afPortalStateClearCacheTask.class.php


示例16: execute

 protected function execute($arguments = array(), $options = array())
 {
     // initialize the database connection
     $databaseManager = new sfDatabaseManager($this->configuration);
     $connection = $databaseManager->getDatabase($options['connection'])->getConnection();
     // load the scanner
     switch ($options['source']) {
         case 'amazon':
             require_once dirname(__FILE__) . '/scanners/artworkScanAmazon.php';
             break;
         case 'meta':
             require_once dirname(__FILE__) . '/scanners/artworkScanMeta.php';
             break;
         case 'folders':
             require_once dirname(__FILE__) . '/scanners/artworkScanFolders.php';
             break;
         case 'service':
             //reserved for future album art services: unused at the moment
             throw new Exception('Not Ready: This is a reserved block for future album art sources.');
             break;
     }
     // resync the database's has_art flag with the users art cache
     if ($options['resync']) {
         require_once dirname(__FILE__) . '/scanners/artworkScanResync.php';
     }
     echo "\r\n";
 }
开发者ID:Alenpiera,项目名称:streeme,代码行数:27,代码来源:scanartTask.class.php


示例17: execute

 protected function execute($args = array(), $options = array())
 {
     // initialize the database connection
     $databaseManager = new sfDatabaseManager($this->configuration);
     $connection = $databaseManager->getDatabase($options['connection'] ? $options['connection'] : null)->getConnection();
     // So we can play with app.yml settings from the application
     $context = sfContext::createInstance($this->configuration);
     $admin = Doctrine::getTable('sfGuardUser')->findOneByUsername('admin');
     for ($i = 0; $i < $options['amount']; $i++) {
         echo "Creating event " . ($i + 1) . " of " . $options['amount'] . "...\n";
         $post = new aEvent();
         $post->author_id = $admin->id;
         $post->status = 'published';
         $post->start_date = aDate::mysql(strtotime($i + 1 . ' days'));
         $post->start_time = date('H:i:s', rand(0, time()));
         $post->end_date = aDate::mysql(strtotime($i + rand(1, 14) . ' days'));
         $post->end_time = date('H:i:s', rand(0, time()));
         $post->excerpt = '';
         $post->location = "1168 E. Passyunk Avenue\nPhiladelphia PA 19147";
         $post->published_at = aDate::mysql(strtotime('-' . ($i + 1) . ' days'));
         $title = implode(' ', $this->getWords(mt_rand(5, 10), $options));
         $body = implode(' ', $this->getWords(mt_rand(20, 100), $options));
         $post->setTitle($title);
         $post->save();
         $slot = $post->Page->createSlot('aRichText');
         $slot->value = $body;
         $slot->save();
         $post->Page->newAreaVersion('blog-body', 'update', array('permid' => 1, 'slot' => $slot));
     }
 }
开发者ID:hashir,项目名称:UoA,代码行数:30,代码来源:aBlogGenerateTestEventsTask.class.php


示例18: execute

 protected function execute($arguments = array(), $options = array())
 {
     $configuration = ProjectConfiguration::getApplicationConfiguration($arguments['application'], $options['env'], true);
     $databaseManager = new sfDatabaseManager($configuration);
     $databaseManager->initialize($configuration);
     $this->db = Doctrine_Manager::connection();
     $this->s3 = new S3(sfConfig::get('app_amazon_access_key'), sfConfig::get('app_amazon_secret_key'));
     // hide strict errors
     error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
     $sql = "SELECT DISTINCT(r.source) FROM reference r ORDER BY id ASC LIMIT " . $options["limit"] . " OFFSET " . $options["offset"];
     $stmt = $this->db->execute($sql);
     $sources = $stmt->fetchAll(PDO::FETCH_COLUMN);
     foreach ($sources as $source) {
         if (!$options["localdir"]) {
             $s3path = ReferenceTable::generateS3path($source);
             if (!$options["overwrite"] && $this->s3->getObjectInfo(sfConfig::get('app_amazon_s3_bucket'), $s3path) !== false) {
                 print "ALREADY UPLOADED: " . $s3path . "\n";
                 continue;
             }
         }
         $this->writeTmpFile($source, $options["debug_mode"], $options["localdir"]);
         if (!$options["localdir"]) {
             $this->uploadTmpFile($source, $options["overwrite"], $options["debug_mode"]);
             if (unlink($this->getLocalPath($source, $options["local_dir"])) && $options["debug_mode"]) {
                 print "REMOVED LOCAL: " . $source . " [" . sha1($source) . "]\n";
             }
         }
         print "----------------------------------------------------------------\n";
     }
     //DONE
     LsCli::beep();
 }
开发者ID:silky,项目名称:littlesis,代码行数:32,代码来源:UploadS3ReferencesTask.class.php


示例19: execute

 protected function execute($arguments = array(), $options = array())
 {
     // initialize the database connection
     $databaseManager = new sfDatabaseManager($this->configuration);
     $connection = $databaseManager->getDatabase($options['connection'])->getConnection();
     // need a scriptname otherwise it uses the symfony file
     if ($arguments['env'] != 'prod') {
         $_SERVER['SCRIPT_NAME'] = '/' . $arguments['application'] . '_' . $arguments['env'] . '.php';
     } else {
         $_SERVER['SCRIPT_NAME'] = '/index.php';
     }
     sfContext::createInstance(sfProjectConfiguration::getApplicationConfiguration($arguments['application'], $arguments['env'], true));
     $searchIndex = new zsSearchIndex($arguments['index']);
     //optimize to increase speed
     $searchIndex->optimize();
     //loop thru all models specified in this index and update all entries
     foreach ($searchIndex->getModels() as $model => $config) {
         $this->logSection('update', 'model: ' . $model);
         foreach (Doctrine::getTable($model)->findAll() as $object) {
             $searchIndex->updateIndex($object);
             echo '.';
         }
         echo "\n";
     }
     //re-optimize index
     $searchIndex->optimize();
 }
开发者ID:kbond,项目名称:zsUtilPlugin,代码行数:27,代码来源:zsSearchUpdateIndexTask.class.php


示例20: getDatabaseParams

 public static function getDatabaseParams($configuration, $dbname = false)
 {
     $dbManager = new sfDatabaseManager($configuration);
     $names = $dbManager->getNames();
     $db = $dbManager->getDatabase($dbname ? $dbname : $names[0]);
     if (!$db) {
         throw new sfException("No database connection called {$db} is defined");
     }
     $username = $db->getParameter('username');
     //root
     $dsn = $db->getParameter('dsn');
     //mysql:dbname=mydbtest;host=localhost because it's test config
     $password = $db->getParameter('password');
     //password
     if (!preg_match('/^mysql:(.*)\\s*$/', $dsn, $matches)) {
         throw new sfException("I don't understand the DSN {$dsn}, sorry");
     }
     $pairs = explode(';', $matches[1]);
     $data = array();
     foreach ($pairs as $pair) {
         list($key, $val) = explode('=', $pair);
         $data[$key] = $val;
     }
     $data['username'] = $username;
     $data['password'] = $password;
     return $data;
 }
开发者ID:pmoutet,项目名称:navinum,代码行数:27,代码来源:sfSyncContentTools.class.php



注:本文中的sfDatabaseManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP sfDoctrinePager类代码示例发布时间:2022-05-23
下一篇:
PHP sfCultureInfo类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap