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


PHP Conversation::fetch方法代碼示例

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


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

示例1: beforeSchemaUpdate

 public static function beforeSchemaUpdate()
 {
     $table = strtolower(get_called_class());
     $schema = Schema::get();
     $schemadef = $schema->getTableDef($table);
     // 2016-01-06 We have to make sure there is no conversation with id==0 since it will screw up auto increment resequencing
     if ($schemadef['fields']['id']['auto_increment']) {
         // since we already have auto incrementing ('serial') we can continue
         return;
     }
     // The conversation will be recreated in upgrade.php, which will
     // generate a new URI, but that's collateral damage for you.
     $conv = new Conversation();
     $conv->id = 0;
     if ($conv->find()) {
         while ($conv->fetch()) {
             // Since we have filtered on 0 this only deletes such entries
             // which I have been afraid wouldn't work, but apparently does!
             // (I thought it would act as null or something and find _all_ conversation entries)
             $conv->delete();
         }
     }
 }
開發者ID:bashrc,項目名稱:gnusocial-debian,代碼行數:23,代碼來源:Conversation.php

示例2: fixupConversationURIs

function fixupConversationURIs()
{
    printfnq("Ensuring all conversations have a URI...");
    $conv = new Conversation();
    $conv->whereAdd('uri IS NULL');
    if ($conv->find()) {
        $rounds = 0;
        while ($conv->fetch()) {
            $uri = common_local_url('conversation', array('id' => $conv->id));
            $sql = sprintf('UPDATE conversation SET uri="%1$s" WHERE id="%2$d";', $conv->escape($uri), $conv->id);
            $conv->query($sql);
            if (($conv->N - ++$rounds) % 500 == 0) {
                printfnq(sprintf(' %d items left...', $conv->N - $rounds));
            }
        }
    }
    printfnq("DONE.\n");
}
開發者ID:bashrc,項目名稱:gnusocial-debian,代碼行數:18,代碼來源:upgrade.php


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