當前位置: 首頁>>代碼示例>>PHP>>正文


PHP text::update方法代碼示例

本文整理匯總了PHP中text::update方法的典型用法代碼示例。如果您正苦於以下問題:PHP text::update方法的具體用法?PHP text::update怎麽用?PHP text::update使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在text的用法示例。


在下文中一共展示了text::update方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: upgrade

 function upgrade()
 {
     global $db;
     // copy each locationref entry to the sectionref
     $srs = $db->selectObjects('sectionref', "module = 'headlineController'");
     foreach ($srs as $sr) {
         $sr->module = 'textController';
         $db->updateObject($sr, 'sectionref');
     }
     $lrs = $db->selectObjects('locationref', "module = 'headlineController'");
     foreach ($lrs as $lr) {
         $lr->module = 'textController';
         $db->updateObject($lr, 'locationref');
     }
     $gps = $db->selectObjects('grouppermission', "module = 'headlineController'");
     foreach ($gps as $gp) {
         $gp->module = 'textController';
         $db->updateObject($gp, 'grouppermission');
     }
     $ups = $db->selectObjects('userpermission', "module = 'headlineController'");
     foreach ($ups as $up) {
         $up->module = 'textController';
         $db->updateObject($up, 'userpermission');
     }
     // convert each headline module to a text module
     $modules_converted = 0;
     $cns = $db->selectObjects('container', "internal LIKE '%headlineController%'");
     foreach ($cns as $cn) {
         $cloc = expUnserialize($cn->internal);
         $cloc->mod = 'textController';
         $cn->internal = serialize($cloc);
         $cn->view = 'showall';
         $cn->action = 'showall';
         $db->updateObject($cn, 'container');
         $modules_converted += 1;
     }
     // create a text item for each headline item
     $headlines_converted = 0;
     $headlines = $db->selectObjects('headline', "1");
     foreach ($headlines as $hl) {
         $text = new text();
         $loc = expUnserialize($hl->location_data);
         $loc->mod = "text";
         $text->location_data = serialize($loc);
         $text->title = $hl->title;
         $text->poster = $hl->poster;
         $text->save();
         $text->created_at = $hl->created_at;
         $text->edited_at = $hl->edited_at;
         $text->update();
         $headlines_converted += 1;
     }
     // FIXME - remove when final
     return "TEST - We're NOT removing the locationref table nor the files yet...<br>" . $modules_converted . " Headline modules were converted.<br>" . $headlines_converted . " Headlines were converted.<br>";
     // delete headline table
     $db->dropTable('locationref');
     // check if the headline controller files are there and remove them
     $files = array(BASE . "framework/modules/definitions/headline.php", BASE . "framework/modules/models/headline.php", BASE . "framework/modules/headline/");
     // delete the files.
     $removed = 0;
     $errors = 0;
     foreach ($files as $file) {
         if (expUtil::isReallyWritable($file)) {
             unlink($file);
             $removed += 1;
         } else {
             $errors += 1;
         }
     }
     return $modules_converted . " Headline modules were converted.<br>" . $headlines_converted . " Headlines were converted.<br>" . $removed . " files were deleted.<br>" . $errors . " files could not be removed.";
 }
開發者ID:notzen,項目名稱:exponent-cms,代碼行數:71,代碼來源:remove_locationref.php


注:本文中的text::update方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。