当前位置: 首页>>代码示例>>PHP>>正文


PHP DatabaseConnection::exec_UPDATEquery方法代码示例

本文整理汇总了PHP中TYPO3\CMS\Core\Database\DatabaseConnection::exec_UPDATEquery方法的典型用法代码示例。如果您正苦于以下问题:PHP DatabaseConnection::exec_UPDATEquery方法的具体用法?PHP DatabaseConnection::exec_UPDATEquery怎么用?PHP DatabaseConnection::exec_UPDATEquery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TYPO3\CMS\Core\Database\DatabaseConnection的用法示例。


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

示例1: copyField

 /**
  * Copies a column into another column on the same or different table.
  * Fails if the columns don't exist in either table.
  *
  * @param string $table
  * @param string $sourceField
  * @param string $destinationField
  * @throws \Exception
  */
 protected function copyField($table, $sourceField, $destinationField)
 {
     $this->expectColumns($table, array($sourceField, $destinationField), "Can't copy {$sourceField} to {$destinationField} in {$table}");
     $this->db->exec_UPDATEquery($table, '', array($destinationField => $sourceField), array($destinationField));
     $this->success("Copied field in table {$table} from {$sourceField} to {$destinationField}");
     return;
 }
开发者ID:electricretina,项目名称:cicbase,代码行数:16,代码来源:AbstractMigration.php

示例2: intval

 /**
  * Updates an already existing board record and stores it into the database.
  *
  * @author  Martin Helmich <m.helmich@mittwald.de>
  * @version 2008-05-16
  * @return  void
  */
 function save_editForum()
 {
     $res = $this->databaseHandle->exec_SELECTquery('*', 'tx_mmforum_forums', 'uid=' . intval($this->param['fid']));
     $ctg = $this->databaseHandle->sql_fetch_assoc($res);
     $updateArray = array('tstamp' => $GLOBALS['EXEC_TIME'], 'hidden' => $this->param['forum']['hidden'], 'forum_name' => trim($this->param['forum']['title']), 'forum_desc' => trim($this->param['forum']['desc']), 'grouprights_read' => $this->param['forum']['authRead'], 'grouprights_write' => $this->param['forum']['authWrite'], 'grouprights_mod' => $this->param['forum']['authMod']);
     if (strlen($updateArray['forum_name']) == 0) {
         return array('title' => '<div class="mm_forum-fatalerror">' . $this->getLL('error.noTitle') . '</div>');
     }
     if ($this->param['forum']['order'] == 'first') {
         $updateArray['sorting'] = 0;
         if ($ctg['sorting'] != 0) {
             $this->globalIncSorting(0, 1, $this->param['forum']['parentID']);
         }
     } elseif ($this->param['forum']['order'] == 'last') {
         $updateArray['sorting'] = $this->getMaxSorting() + 1;
     } else {
         if ($this->param['forum']['order'] != $ctg['sorting']) {
             $this->globalIncSorting($this->param['forum']['order'], 2, $this->param['forum']['parentID']);
         }
         $updateArray['sorting'] = $this->param['forum']['order'];
     }
     $this->databaseHandle->exec_UPDATEquery('tx_mmforum_forums', 'uid=' . intval($this->param['fid']), $updateArray);
     if ($updateArray['grouprights_read'] != $ctg['grouprights_read']) {
         $this->delete_forumIndex($ctg['uid']);
     }
 }
开发者ID:rabe69,项目名称:mm_forum,代码行数:33,代码来源:class.tx_mmforum_forumadmin.php

示例3: array

    /**
     * Release a process and the required resources
     *
     * @param  mixed    $releaseIds   string with a single process-id or array with multiple process-ids
     * @param  boolean  $withinLock   show whether the DB-actions are included within an existing lock
     * @return boolean
     */
    function CLI_releaseProcesses($releaseIds, $withinLock = false)
    {
        if (!is_array($releaseIds)) {
            $releaseIds = array($releaseIds);
        }
        if (!count($releaseIds) > 0) {
            return false;
            //nothing to release
        }
        if (!$withinLock) {
            $this->db->sql_query('BEGIN');
        }
        // some kind of 2nd chance algo - this way you need at least 2 processes to have a real cleanup
        // this ensures that a single process can't mess up the entire process table
        // mark all processes as deleted which have no "waiting" queue-entires and which are not active
        $this->db->exec_UPDATEquery('tx_crawler_queue', 'process_id IN (SELECT process_id FROM tx_crawler_process WHERE active=0 AND deleted=0)', array('process_scheduled' => 0, 'process_id' => ''));
        $this->db->exec_UPDATEquery('tx_crawler_process', 'active=0 AND deleted=0
			AND NOT EXISTS (
				SELECT * FROM tx_crawler_queue
				WHERE tx_crawler_queue.process_id = tx_crawler_process.process_id
				AND tx_crawler_queue.exec_time = 0
			)', array('deleted' => '1', 'system_process_id' => 0));
        // mark all requested processes as non-active
        $this->db->exec_UPDATEquery('tx_crawler_process', 'process_id IN (\'' . implode('\',\'', $releaseIds) . '\') AND deleted=0', array('active' => '0'));
        $this->db->exec_UPDATEquery('tx_crawler_queue', 'exec_time=0 AND process_id IN ("' . implode('","', $releaseIds) . '")', array('process_scheduled' => 0, 'process_id' => ''));
        if (!$withinLock) {
            $this->db->sql_query('COMMIT');
        }
        return true;
    }
开发者ID:nawork,项目名称:crawler,代码行数:37,代码来源:class.tx_crawler_lib.php

示例4: saveQueryInAction

 /**
  * Save query in action
  *
  * @param int $uid
  * @return int
  */
 public function saveQueryInAction($uid)
 {
     if (ExtensionManagementUtility::isLoaded('sys_action')) {
         $keyArr = explode(',', $this->storeList);
         $saveArr = array();
         foreach ($keyArr as $k) {
             $saveArr[$k] = $GLOBALS['SOBE']->MOD_SETTINGS[$k];
         }
         $qOK = 0;
         // Show query
         if ($saveArr['queryTable']) {
             /** @var \TYPO3\CMS\Core\Database\QueryGenerator */
             $qGen = GeneralUtility::makeInstance(QueryGenerator::class);
             $qGen->init('queryConfig', $saveArr['queryTable']);
             $qGen->makeSelectorTable($saveArr);
             $qGen->enablePrefix = 1;
             $qString = $qGen->getQuery($qGen->queryConfig);
             $qCount = $this->databaseConnection->SELECTquery('count(*)', $qGen->table, $qString . BackendUtility::deleteClause($qGen->table));
             $qSelect = $qGen->getSelectQuery($qString);
             $res = @$this->databaseConnection->sql_query($qCount);
             if (!$this->databaseConnection->sql_error()) {
                 $this->databaseConnection->sql_free_result($res);
                 $dA = array();
                 $dA['t2_data'] = serialize(array('qC' => $saveArr, 'qCount' => $qCount, 'qSelect' => $qSelect, 'qString' => $qString));
                 $this->databaseConnection->exec_UPDATEquery('sys_action', 'uid=' . (int) $uid, $dA);
                 $qOK = 1;
             }
         }
         return $qOK;
     }
     return null;
 }
开发者ID:dachcom-digital,项目名称:TYPO3.CMS,代码行数:38,代码来源:QueryView.php

示例5: performUpdate

 /**
  * Performs the database update.
  *
  * @param array $dbQueries queries done in this update
  * @param mixed $customMessages custom messages
  * @return boolean TRUE on success, FALSE on error
  */
 public function performUpdate(array &$dbQueries, &$customMessages)
 {
     $this->init();
     if (!PATH_site) {
         throw new \Exception('PATH_site was undefined.');
     }
     $fileadminDirectory = rtrim($GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir'], '/');
     $targetDirectory = '/_migrated/RTE/';
     $fullTargetDirectory = PATH_site . $fileadminDirectory . $targetDirectory;
     // Create the directory, if necessary
     if (!is_dir($fullTargetDirectory)) {
         \TYPO3\CMS\Core\Utility\GeneralUtility::mkdir_deep($fullTargetDirectory);
     }
     $oldRecords = $this->findMagicImagesInOldLocation();
     foreach ($oldRecords as $refRecord) {
         // Is usually uploads/RTE_magicC_123423324.png.png
         $sourceFileName = $refRecord['ref_string'];
         // Absolute path/filename
         $fullSourceFileName = PATH_site . $refRecord['ref_string'];
         $targetFileName = $targetDirectory . \TYPO3\CMS\Core\Utility\PathUtility::basename($refRecord['ref_string']);
         // Full directory
         $fullTargetFileName = $fullTargetDirectory . \TYPO3\CMS\Core\Utility\PathUtility::basename($refRecord['ref_string']);
         // maybe the file has been moved previously
         if (!file_exists($fullTargetFileName)) {
             // If the source file does not exist, we should just continue, but leave a message in the docs;
             // ideally, the user would be informed after the update as well.
             if (!file_exists(PATH_site . $sourceFileName)) {
                 $this->logger->notice('File ' . $sourceFileName . ' does not exist. Reference was not migrated.', array());
                 $format = 'File \'%s\' does not exist. Referencing field: %s.%d.%s. The reference was not migrated.';
                 $message = sprintf($format, $sourceFileName, $refRecord['tablename'], $refRecord['recuid'], $refRecord['field']);
                 $customMessages .= PHP_EOL . $message;
                 continue;
             }
             rename($fullSourceFileName, $fullTargetFileName);
         }
         // Get the File object
         $file = $this->storage->getFile($targetFileName);
         if ($file instanceof \TYPO3\CMS\Core\Resource\File) {
             // And now update the referencing field
             $targetFieldName = $refRecord['field'];
             $targetRecord = $this->db->exec_SELECTgetSingleRow('uid, ' . $targetFieldName, $refRecord['tablename'], 'uid=' . (int) $refRecord['recuid']);
             if ($targetRecord) {
                 // Replace the old filename with the new one, and add data-* attributes used by the RTE
                 $searchString = 'src="' . $sourceFileName . '"';
                 $replacementString = 'src="' . $fileadminDirectory . $targetFileName . '"';
                 $replacementString .= ' data-htmlarea-file-uid="' . $file->getUid() . '"';
                 $replacementString .= ' data-htmlarea-file-table="sys_file"';
                 $targetRecord[$targetFieldName] = str_replace($searchString, $replacementString, $targetRecord[$targetFieldName]);
                 // Update the record
                 $this->db->exec_UPDATEquery($refRecord['tablename'], 'uid=' . (int) $refRecord['recuid'], array($targetFieldName => $targetRecord[$targetFieldName]));
                 $queries[] = str_replace(LF, ' ', $this->db->debug_lastBuiltQuery);
                 // Finally, update the sys_refindex table as well
                 $this->db->exec_UPDATEquery('sys_refindex', 'hash=' . $this->db->fullQuoteStr($refRecord['hash'], 'sys_refindex'), array('ref_table' => 'sys_file', 'softref_key' => 'rtehtmlarea_images', 'ref_uid' => $file->getUid(), 'ref_string' => $fileadminDirectory . $targetFileName));
                 $queries[] = str_replace(LF, ' ', $this->db->debug_lastBuiltQuery);
             }
         }
     }
     return TRUE;
 }
开发者ID:khanhdeux,项目名称:typo3test,代码行数:66,代码来源:RteMagicImagesUpdateWizard.php

示例6: migrateRelativeFilemounts

 /**
  * Relative filemounts are transformed to relate to our fileadmin/ storage
  * and their path is modified to be a valid resource location
  *
  * @return void
  */
 protected function migrateRelativeFilemounts()
 {
     $relativeFilemounts = $this->db->exec_SELECTgetRows('*', 'sys_filemounts', 'base = 1' . BackendUtility::deleteClause('sys_filemounts'));
     foreach ($relativeFilemounts as $filemount) {
         $this->db->exec_UPDATEquery('sys_filemounts', 'uid=' . (int) $filemount['uid'], array('base' => $this->storage->getUid(), 'path' => '/' . ltrim($filemount['path'], '/')));
         $this->sqlQueries[] = $GLOBALS['TYPO3_DB']->debug_lastBuiltQuery;
     }
 }
开发者ID:Mr-Robota,项目名称:TYPO3.CMS,代码行数:14,代码来源:FilemountUpdateWizard.php

示例7: updateTopicPostCount

 /**
  *
  * Updates a topics's post count.
  *
  * @author  Martin Helmich <m.helmich@mittwald.de>
  * @version 2007-07-21
  * @param   int   $topic_uid  The UID of the topic whose post count is to be
  *                            updated
  * @param   string $orderBy   The column name of the tx_mmforum_posts table
  *                            used for ordering posts (see
  *                            http://forge.typo3.org/issues/show/3520 for
  *                            for more information).
  * @return  void
  */
 function updateTopicPostCount($topic_uid, $orderBy = 'post_time')
 {
     $topic_uid = intval($topic_uid);
     $res = $this->databaseHandle->exec_SELECTquery('uid', 'tx_mmforum_posts', 'topic_id=' . $topic_uid . ' AND deleted=0' . $this->getPidQuery(), '', $orderBy . ' DESC');
     list($last_post_id) = $this->databaseHandle->sql_fetch_row($res);
     $postcount = $this->databaseHandle->sql_num_rows($res);
     $updateArray = array('tstamp' => $GLOBALS['EXEC_TIME'], 'topic_last_post_id' => $last_post_id, 'topic_replies' => $postcount - 1);
     $this->databaseHandle->exec_UPDATEquery('tx_mmforum_topics', 'uid=' . $topic_uid, $updateArray);
 }
开发者ID:rabe69,项目名称:mm_forum,代码行数:23,代码来源:class.tx_mmforum_postfactory.php

示例8: update

 /**
  * Updates an existing file object in the database
  *
  * @param ProcessedFile $processedFile
  * @return void
  */
 public function update($processedFile)
 {
     if ($processedFile->isPersisted()) {
         $uid = (int) $processedFile->getUid();
         $updateFields = $this->cleanUnavailableColumns($processedFile->toArray());
         $updateFields['tstamp'] = time();
         $this->databaseConnection->exec_UPDATEquery($this->table, 'uid=' . (int) $uid, $updateFields);
     }
 }
开发者ID:rickymathew,项目名称:TYPO3.CMS,代码行数:15,代码来源:ProcessedFileRepository.php

示例9: canLoadADummyCollectionFromDatabaseAfterRemoveOneRelation

 /**
  * @test
  * @return void
  */
 public function canLoadADummyCollectionFromDatabaseAfterRemoveOneRelation()
 {
     // Remove one relation
     $fakeName = array('tablenames' => $this->getUniqueId('name'));
     $this->database->exec_UPDATEquery('sys_category_record_mm', 'uid_foreign = 1', $fakeName);
     // Check the number of records
     $collection = \TYPO3\CMS\Core\Category\Collection\CategoryCollection::load($this->categoryUid, true, $this->tableName);
     $this->assertEquals($this->numberOfRecords - 1, $collection->count());
 }
开发者ID:rickymathew,项目名称:TYPO3.CMS,代码行数:13,代码来源:CategoryCollectionTest.php

示例10: putUrlToCache

 /**
  * Sets the entry to cache.
  *
  * @param UrlCacheEntry $cacheEntry
  * @return void
  */
 public function putUrlToCache(UrlCacheEntry $cacheEntry)
 {
     $data = array('original_url' => $cacheEntry->getOriginalUrl(), 'page_id' => $cacheEntry->getPageId(), 'request_variables' => json_encode($cacheEntry->getRequestVariables()), 'rootpage_id' => $cacheEntry->getRootPageId(), 'speaking_url' => $cacheEntry->getSpeakingUrl());
     if ($cacheEntry->getCacheId()) {
         $this->databaseConnection->exec_UPDATEquery('tx_realurl_urlcache', 'uid=' . $this->databaseConnection->fullQuoteStr($cacheEntry->getCacheId(), 'tx_realurl_urlcache'), $data);
     } else {
         $this->databaseConnection->exec_INSERTquery('tx_realurl_urlcache', $data);
         $cacheEntry->setCacheId($this->databaseConnection->sql_insert_id());
     }
 }
开发者ID:rvock,项目名称:typo3-realurl,代码行数:16,代码来源:DatabaseCache.php

示例11: updateFeedImportRecord

 /**
  * updates the IRRE data in the feedimport record, so that image records are
  * displayed correctly beneith the image select box
  */
 private function updateFeedImportRecord()
 {
     $feedImportUid = $this->feedImport['uid'];
     $imgUids = array();
     foreach ($this->images as $fileName => $image) {
         $imgUids[] = $image['uid'];
     }
     $updateRecord = array('image_records' => implode(',', $imgUids), 'tstamp' => time());
     $this->db->exec_UPDATEquery('tx_gorillary_feedimports', "uid='{$feedImportUid}'", $updateRecord);
 }
开发者ID:visol,项目名称:ext-gorillary,代码行数:14,代码来源:class.tx_gorillary_feedimport_save_hook.php

示例12: markExtensionWithMaximumVersionAsCurrent

 /**
  * Sets current_version = 1 for all extensions where the extension version is maximal.
  *
  * For performance reasons, the "native" TYPO3_DB is used here directly.
  *
  * @param int $repositoryUid
  * @return void
  */
 protected function markExtensionWithMaximumVersionAsCurrent($repositoryUid)
 {
     $uidsOfCurrentVersion = $this->fetchMaximalVersionsForAllExtensions($repositoryUid);
     // some DBMS limit the amount of expressions, apply the update in chunks
     $chunks = array_chunk($uidsOfCurrentVersion, self::CHUNK_SIZE);
     $chunkCount = count($chunks);
     for ($i = 0; $i < $chunkCount; ++$i) {
         $this->databaseConnection->exec_UPDATEquery(self::TABLE_NAME, 'uid IN (' . implode(',', $chunks[$i]) . ')', array('current_version' => 1));
     }
 }
开发者ID:Mr-Robota,项目名称:TYPO3.CMS,代码行数:18,代码来源:ExtensionRepository.php

示例13: updateCollectionRecord

 /**
  * updates the IRRE data in the collection record, so that image records are
  * displayed correctly beneith the image select box
  */
 private function updateCollectionRecord()
 {
     $collectionId = $this->collection['uid'];
     $imgUids = array();
     $fileNames = $this->collection['images'];
     $fileNames = explode(',', $fileNames);
     foreach ($fileNames as $filename) {
         $imgUids[] = $this->images[$filename]['uid'];
     }
     $updateRecord = array('image_records' => implode(',', $imgUids), 'tstamp' => time());
     $this->db->exec_UPDATEquery('tx_gorillary_collections', "uid='{$collectionId}'", $updateRecord);
 }
开发者ID:visol,项目名称:ext-gorillary,代码行数:16,代码来源:class.tx_gorillary_collection_save_hook.php

示例14: updateFlexformCategories

 /**
  * Update categories in flexforms
  *
  * @param string $pluginName
  * @param array $oldNewCategoryUidMapping
  * @param string $flexformField name of the flexform's field to look for
  * @return void
  */
 protected function updateFlexformCategories($pluginName, $oldNewCategoryUidMapping, $flexformField)
 {
     $count = 0;
     $title = 'Update flexforms categories (' . $pluginName . ':' . $flexformField . ')';
     $res = $this->databaseConnection->exec_SELECTquery('uid, pi_flexform', 'tt_content', 'CType=\'list\' AND list_type=\'' . $pluginName . '\' AND deleted=0');
     /** @var \TYPO3\CMS\Core\Configuration\FlexForm\FlexFormTools $flexformTools */
     $flexformTools = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Configuration\\FlexForm\\FlexFormTools');
     while ($row = $this->databaseConnection->sql_fetch_assoc($res)) {
         $status = null;
         $xmlArray = GeneralUtility::xml2array($row['pi_flexform']);
         if (!is_array($xmlArray) || !isset($xmlArray['data'])) {
             $status = FlashMessage::ERROR;
             $message = 'Flexform data of plugin "' . $pluginName . '" not found.';
         } elseif (!isset($xmlArray['data']['sDEF']['lDEF'])) {
             $status = FlashMessage::WARNING;
             $message = 'Flexform data of record tt_content:' . $row['uid'] . ' did not contain sheet: sDEF';
         } elseif (isset($xmlArray[$flexformField . '_updated'])) {
             $status = FlashMessage::NOTICE;
             $message = 'Flexform data of record tt_content:' . $row['uid'] . ' is already updated for ' . $flexformField . '. No update needed...';
         } else {
             // Some flexforms may have displayCond
             if (isset($xmlArray['data']['sDEF']['lDEF'][$flexformField]['vDEF'])) {
                 $updated = false;
                 $oldCategories = GeneralUtility::trimExplode(',', $xmlArray['data']['sDEF']['lDEF'][$flexformField]['vDEF'], true);
                 if (!empty($oldCategories)) {
                     $newCategories = array();
                     foreach ($oldCategories as $uid) {
                         if (isset($oldNewCategoryUidMapping[$uid])) {
                             $newCategories[] = $oldNewCategoryUidMapping[$uid];
                             $updated = true;
                         } else {
                             $status = FlashMessage::WARNING;
                             $message = 'The category ' . $uid . ' of record tt_content:' . $row['uid'] . ' was not found in sys_category records. Maybe the category was deleted before the migration? Please check manually...';
                         }
                     }
                     if ($updated) {
                         $count++;
                         $xmlArray[$flexformField . '_updated'] = 1;
                         $xmlArray['data']['sDEF']['lDEF'][$flexformField]['vDEF'] = implode(',', $newCategories);
                         $this->databaseConnection->exec_UPDATEquery('tt_content', 'uid=' . $row['uid'], array('pi_flexform' => $flexformTools->flexArray2Xml($xmlArray)));
                     }
                 }
             }
         }
         if ($status !== null) {
             $this->messageArray[] = array($status, $title, $message);
         }
     }
     $status = FlashMessage::INFO;
     $message = 'Updated ' . $count . ' tt_content flexforms for  "' . $pluginName . ':' . $flexformField . '"';
     $this->messageArray[] = array($status, $title, $message);
 }
开发者ID:kalypso63,项目名称:news,代码行数:60,代码来源:class.ext_update.php

示例15: migrateTtContentPlugins

 /**
  *
  */
 protected function migrateTtContentPlugins()
 {
     $contentElements = $this->databaseConnection->exec_SELECTgetRows('*', 'tt_content', '1=1');
     foreach ($contentElements as $contentElement) {
         foreach ($this->legacyTtContentListTypes as $legacyTtContentListType) {
             $newTtContentListType = str_replace('mmforum_', 'typo3forum_', $legacyTtContentListType);
             if ($contentElement['list_type'] === $legacyTtContentListType) {
                 $contentElement['list_type'] = $newTtContentListType;
                 $this->databaseConnection->exec_UPDATEquery('tt_content', 'uid = ' . (int) $contentElement['uid'], $contentElement);
             }
         }
     }
 }
开发者ID:steffmeister,项目名称:typo3-forum,代码行数:16,代码来源:DatabaseMigrator.php


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