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


PHP printpre函数代码示例

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


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

示例1: harmoni_0_12_4_update

 /**
  * Add the creator column to the dr_asset_info table.
  * 
  * @param int $dbIndex
  * @return void
  * @access public
  * @since 10/8/07
  */
 public static function harmoni_0_12_4_update($dbIndex)
 {
     $dbc = Services::getService("DBHandler");
     try {
         $dbc->query(new GenericSQLQuery("DROP INDEX log_entry_timestamp_index"), $dbIndex);
         printpre("Dropping index 'log_entry_timestamp_index'.");
     } catch (DatabaseException $e) {
         // 			printpre("NOT dropping index 'log_entry_timestamp_index'.");
         // 			printpre($e->getMessage());
     }
     try {
         $dbc->query(new GenericSQLQuery('CREATE INDEX log_entry_format_index ON log_entry (log_name, fk_format_type, fk_priority_type, "timestamp");'), $dbIndex);
         printpre("Creating index 'log_entry_format_index'.");
     } catch (DatabaseException $e) {
         // 			printpre("NOT creating index 'log_entry_format_index'.");
         // 			printpre($e->getMessage());
     }
     try {
         $dbc->query(new GenericSQLQuery('CREATE INDEX log_agent_fk_entry_index ON log_agent (fk_entry);'), $dbIndex);
         printpre("Creating index 'log_agent_fk_entry_index'.");
     } catch (DatabaseException $e) {
         // 			printpre("NOT creating index 'log_agent_fk_entry_index'.");
         // 			printpre($e->getMessage());
     }
     try {
         $dbc->query(new GenericSQLQuery('CREATE INDEX log_node_fk_entry_index ON log_node (fk_entry);'), $dbIndex);
         printpre("Creating index 'log_node_fk_entry_index'.");
     } catch (DatabaseException $e) {
         // 			printpre("NOT creating index 'log_node_fk_entry_index'.");
         // 			printpre($e->getMessage());
     }
 }
开发者ID:adamfranco,项目名称:harmoni,代码行数:40,代码来源:PostgreSQLUtils.class.php

示例2: execute

 /**
  * Execute this action.
  * 
  * @return mixed
  * @access public
  * @since 4/25/05
  */
 function execute()
 {
     $harmoni = Harmoni::instance();
     // Set the new language
     $langLoc = Services::getService('Lang');
     $harmoni->request->startNamespace("polyphony");
     $langLoc->setLanguage($harmoni->request->get("language"));
     $harmoni->request->endNamespace();
     debug::output("Setting the language to " . $harmoni->request->get("polyphony/language"));
     debug::output("SESSION: " . printpre($_SESSION, TRUE));
     $harmoni->history->goBack("polyphony/language/change");
     $null = null;
     return $null;
 }
开发者ID:adamfranco,项目名称:polyphony,代码行数:21,代码来源:change.act.php

示例3: execute

 /**
  * Execute the action
  * 
  * @return void
  * @access public
  * @since 7/10/08
  */
 public function execute()
 {
     if (!$this->isAuthorizedToExecute()) {
         throw new PermissionDeniedException();
     }
     $authZ = Services::getService("AuthZ");
     $idManager = Services::getService("Id");
     $hierarchyManager = Services::getService('Hierarchy');
     $site = SiteDispatcher::getCurrentRootNode();
     $hierarchy = $hierarchyManager->getHierarchy($idManager->getId("edu.middlebury.authorization.hierarchy"));
     $infoList = $hierarchy->traverse($idManager->getId($site->getId()), Hierarchy::TRAVERSE_MODE_DEPTH_FIRST, Hierarchy::TRAVERSE_DIRECTION_DOWN, Hierarchy::TRAVERSE_LEVELS_ALL);
     $status = new StatusStars(str_replace('%1', $infoList->count(), _("Rebuilding Implicit AZs on %1 nodes.")));
     $status->initializeStatistics($infoList->count());
     $azCache = $authZ->getAuthorizationCache();
     while ($infoList->hasNext()) {
         $info = $infoList->next();
         $node = $hierarchy->getNode($info->getNodeId());
         // 			printpre("Rebuilding implicit AZs for ".$node->getId()." '".$node->getDisplayName()."'. Ancestors:");
         // 			printpre($node->getAncestorIds());
         $azCache->createHierarchyImplictAZs($node, $node->getAncestorIds());
         $status->updateStatistics();
     }
     printpre("Done.");
     /*********************************************************
      * Log the event
      *********************************************************/
     if (Services::serviceRunning("Logging")) {
         $loggingManager = Services::getService("Logging");
         $log = $loggingManager->getLogForWriting("Segue");
         $formatType = new Type("logging", "edu.middlebury", "AgentsAndNodes", "A format in which the acting Agent[s] and the target nodes affected are specified.");
         $priorityType = new Type("logging", "edu.middlebury", "Error", "Errors that did not halt execution");
         $item = new AgentNodeEntryItem("Rebuilt Implict AZs", "Hierarchy-Implicit AZs for site '" . $site->getDisplayName() . "' were rebuilt manually.");
         $item->addNodeId($site->getQualifierId());
         $log->appendLogWithTypes($item, $formatType, $priorityType);
     }
 }
开发者ID:adamfranco,项目名称:segue,代码行数:43,代码来源:rebuildImplicit.act.php

示例4: printQueryWithTime

function printQueryWithTime($queryArray, $key)
{
    printf("\n<hr />QueryTime: %4s seconds", $key);
    printf("\n<br/>NumQueries: %d", count($queryArray));
    foreach ($queryArray as $query) {
        printpre($query);
    }
}
开发者ID:adamfranco,项目名称:segue-1.x,代码行数:8,代码来源:index.php

示例5: runUpdate

 /**
  * Run the update
  * 
  * @return boolean
  * @access public
  * @since 7/8/08
  */
 function runUpdate()
 {
     $pluginMgr = Services::getService("PluginManager");
     try {
         $pluginMgr->installPlugin(new Type('SeguePlugins', 'edu.middlebury', 'NextPrevious'));
         $pluginMgr->enablePlugin(new Type('SeguePlugins', 'edu.middlebury', 'NextPrevious'));
     } catch (Exception $e) {
         printpre($e->getMessage());
     }
     return $this->isInPlace();
 }
开发者ID:adamfranco,项目名称:segue,代码行数:18,代码来源:Update016_NextPreviousPlugin.act.php

示例6: db_connect

// include all necessary files
include "includes.inc.php";
db_connect($dbhost, $dbuser, $dbpass, $dbdb);
if ($del = $_REQUEST[del]) {
    // we're deleting something
    //	print $del;
    if ($del == 'group') {
        $query = "UPDATE class SET FK_classgroup=NULL WHERE FK_classgroup='" . addslashes($_REQUEST['group']) . "'";
        db_query($query);
        $query = "DELETE FROM classgroup WHERE classgroup_id='" . addslashes($_REQUEST['group']) . "'";
        db_query($query);
        log_entry("classgroups", "" . $_SESSION['auser'] . " removed group " . db_get_value("classgroup", "classgroup_name", "classgroup_id='" . addslashes($_REQUEST[group]) . "'"), "NULL", '".addslashes($group)."', "classgroup");
    }
    if ($del == 'class') {
        $query = "UPDATE class SET FK_classgroup=NULL WHERE class_id='" . addslashes($_REQUEST['class']) . "'";
        printpre($query);
        db_query($query);
        log_entry("classgroup", "" . $_SESSION['auser'] . " removed {$class} from group " . db_get_value("classgroup", "classgroup_name", "classgroup_id='" . addslashes($_REQUEST[group]) . "'"), "NULL", $_REQUEST[group], "classgroup");
    }
    print <<<END

<script type='text/javascript'>
// <![CDATA[

\tfunction updater() {
\t\topener.window.location="index.php?{$sid}"; 
\t}

// ]]>
</script>
开发者ID:adamfranco,项目名称:segue-1.x,代码行数:30,代码来源:edit_groups.php

示例7: update

 /**
  * Tells the wizard component to update itself - this may include getting
  * form post data or validation - whatever this particular component wants to
  * do every pageload. 
  * @param string $fieldName The field name to use when outputting form data or
  * similar parameters/information.
  * @access public
  * @return boolean - TRUE if everything is OK
  */
 function update($fieldName)
 {
     $children = $this->getChildren();
     $ok = true;
     foreach (array_keys($children) as $key) {
         if (is_null($children[$key])) {
             printpre(array_keys($children));
             print $key;
             throwError(new Error("prob", ""));
         }
         if (!$children[$key]->update($fieldName . "_" . $key)) {
             $ok = false;
         }
     }
     return $ok;
 }
开发者ID:adamfranco,项目名称:polyphony,代码行数:25,代码来源:WStyleCollection.class.php

示例8: updateRepeatablePart

 /**
  * Update the given repeatable part to reflect the value changed in the wizard.
  *
  * For "Value from Wizard" = wizVal and  "value originally in Part" = partVal
  *	- If a partVal exists and is equal to a wizVal, leave it alone
  *	- If a partVal exists, but is not equal to any wizVals, remove it.
  *	- If a wizVal exists, but no partVals equal to it exist, add a new Part
  * 
  * @param array $results, the wizard results
  * @param array $initialState, the initial wizard results
  * @param object Record $record
  * @param object Id $assetId
  * @return void
  * @access public
  * @since 10/24/05
  */
 function updateRepeatablePart($partResults, $partInitialState, $partStruct, $record, $assetId)
 {
     $partStructId = $partStruct->getId();
     $partValsHandled = array();
     // 		printpre("<hr/>");
     // 		printpre($partResults);
     $parts = $record->getPartsByPartStructure($partStructId);
     while ($parts->hasNext()) {
         $part = $parts->next();
         $partVal = $part->getValue();
         $partStrVal = $partVal->asString();
         // Check for existance in the results.
         // if the value is not in the results, remove the part and continue.
         if (!$partStrVal || !$this->inWizArray($partVal, 'partvalue', $partResults)) {
             $record->deletePart($part->getId());
             $partValsHandled[] = $partStrVal;
             $partId = $part->getId();
             printpre("\tDeleting Part: Id: " . $partId->getIdString() . " Value: " . $partStrVal);
             continue;
         }
         // If the value is in the wizard results, do nothing
         $partValsHandled[] = $partStrVal;
         $partId = $part->getId();
         printpre("\tIgnoring Part: Id: " . $partId->getIdString() . " Value: " . $partStrVal);
         // Add this value to the Structured Tags list for this asset.
         $tagGenerator = StructuredMetaDataTagGenerator::instance();
         if ($tagGenerator->shouldGenerateTagsForPartStructure($partStruct->getRepositoryId(), $partStructId)) {
             $this->_newStructuredTagValues[$assetId->getIdString()][] = $partStrVal;
         }
         continue;
     }
     // Go through all of the Wizard result values. If any of them haven't
     // been handled and need to be, add them.
     foreach ($partResults as $key => $valueArray) {
         $value = $valueArray['partvalue'];
         if (is_object($value)) {
             $valueStr = $value->asString();
             $authZManager = Services::getService("AuthZ");
             $idManager = Services::getService("Id");
             $authoritativeValues = $partStruct->getAuthoritativeValues();
             if ($authZManager->isUserAuthorized($idManager->getId("edu.middlebury.authorization.modify_authority_list"), $this->getRepositoryId()) && !$partStruct->isAuthoritativeValue($value) && $authoritativeValues->hasNext()) {
                 $partStruct->addAuthoritativeValue($value);
                 printpre("\tAdding AuthoritativeValue:" . $valueStr);
             }
             if (!in_array($valueStr, $partValsHandled)) {
                 $part = $record->createPart($partStructId, $value);
                 $partId = $part->getId();
                 printpre("\tAdding Part: Id: " . $partId->getIdString() . " Value: " . $valueStr);
                 // Add this value to the Structured Tags list for this asset.
                 $tagGenerator = StructuredMetaDataTagGenerator::instance();
                 if ($tagGenerator->shouldGenerateTagsForPartStructure($partStruct->getRepositoryId(), $partStructId)) {
                     $this->_newStructuredTagValues[$assetId->getIdString()][] = $valueStr;
                 }
             }
         }
     }
 }
开发者ID:adamfranco,项目名称:concerto,代码行数:73,代码来源:edit.act.php

示例9: allSitesSlots

/**
 * Build an array of all of the sites and slots that the user
 * is either the owner of or an editor (has permission add, edit, and delete) of
 */
function allSitesSlots($user)
{
    global $classes, $usersFutureClasses;
    $allsites = array();
    // The user's personal site
    if ($user == slot::getOwner($user) || !slot::exists($user)) {
        $allsites[$user] = array();
        $allsites[$user]['slot_name'] = $user;
        $allsites[$user]['slot_type'] = 'personal';
        $allsites[$user]['owner_uname'] = $user;
        $allsites[$user]['site_exits'] = false;
    }
    // Add slots that the user is an owner of.
    // This will include all of the created sites as well
    $allsites = array_merge($allsites, $slots);
    // Add the sites that the user is a Site-Level Editor for.
    $allsites = array_merge($allsites, segue::getSiteInfoWhereUserIsSiteLevelEditor($user));
    $sitesEditorOf = segue::getSiteInfoWhereUserIsSiteLevelEditor($user);
    $usersAllClasses = array();
    if ($_SESSION[atype] == 'prof') {
        foreach ($classes as $n => $v) {
            $usersAllClasses[] = $n;
        }
        foreach ($usersFutureClasses as $n => $v) {
            $usersAllClasses[] = $n;
        }
    }
    printpre($allsites);
    printpre($usersAllClasses);
    printpre($sitesEditorOf);
    printpre($sitesOwnerOf);
    printpre($slots);
    $allsites = array_unique(array_merge($allsites, $usersAllClasses, $sitesOwnerOf, $sitesEditorOf, $slots));
    $allGroups = group::getGroupsOwnedBy($user);
    $sitesInGroups = array();
    foreach ($allGroups as $n => $g) {
        $sitesInGroups = array_unique(array_merge($sitesInGroups, group::getClassesFromName($g)));
    }
    foreach ($allsites as $n => $site) {
        if (!in_array($site, $sitesInGroups)) {
            $allsites2[] = $site;
        }
    }
    $allsites = array_merge($allsites2, $allGroups);
    asort($allsites);
    /*	print "<pre>"; print_r($usersAllClasses); print "</pre>"; */
    $sites = array();
    $slots = array();
    foreach ($allsites as $n => $site) {
        $siteObj =& new site($site);
        $exists = $siteObj->fetchFromDB();
        if ($exists) {
            $sites[] = $site;
        } else {
            $slots[] = $site;
        }
    }
    return array($sites, $slots);
}
开发者ID:adamfranco,项目名称:segue-1.x,代码行数:63,代码来源:default.inc.php

示例10: runUpdate


//.........这里部分代码省略.........
             }
         }
         /*********************************************************
          * Authorizations
          *********************************************************/
         $azMgr1 = Services::getService("AuthZ");
         if (get_class($hierarchyMgr1) == "AuthZ2_AuthorizationManager") {
             throw new OperationFailedException("Original HierarchyManager not configured.");
         }
         // Add all of the Authorization functions
         $functionTypes = $azMgr1->getFunctionTypes();
         while ($functionTypes->hasNext()) {
             $oldFunctions = $azMgr1->getFunctions($functionTypes->next());
             while ($oldFunctions->hasNext()) {
                 $oldFunction = $oldFunctions->next();
                 // Get or create the function
                 try {
                     $newFunction = $azMgr2->getFunction($oldFunction->getId());
                 } catch (UnknownIdException $e) {
                     $newFunction = $azMgr2->createFunction($oldFunction->getId(), $oldFunction->getReferenceName(), $oldFunction->getDescription(), $oldFunction->getFunctionType(), $oldFunction->getQualifierHierarchyId());
                 }
                 // Get all authorizations for this function.
                 $oldAZs = $azMgr1->getExplicitAZs(null, $oldFunction->getId(), null, false);
                 $status = new StatusStars("Migrating '" . $newFunction->getReferenceName() . "' Authorizations (" . $oldAZs->count() . ")");
                 $status->initializeStatistics($oldAZs->count());
                 while ($oldAZs->hasNext()) {
                     $oldAZ = $oldAZs->next();
                     $status->updateStatistics();
                     try {
                         $oldQualifier = $oldAZ->getQualifier();
                     } catch (UnknownIdException $e) {
                         // continue if the qualifier no longer exists.
                         continue;
                     }
                     // Add the new authorization
                     try {
                         $newAZ = $azMgr2->createAuthorization($oldAZ->getAgentId(), $oldAZ->getFunction()->getId(), $oldQualifier->getId());
                         if ($oldAZ->getExpirationDate()) {
                             $newAZ->updateExpirationDate($oldAZ->getExpirationDate());
                         }
                         if ($oldAZ->getEffectiveDate()) {
                             $newAZ->updateEffectiveDate($oldAZ->getEffectiveDate());
                         }
                     } catch (OperationFailedException $e) {
                     }
                 }
             }
         }
     } catch (Exception $e) {
         printpre($e->getMessage());
         HarmoniErrorHandler::printDebugBacktrace($e->getTrace());
         printpre("An error has occurred. Removing new tables.");
         try {
             $query = new GenericSQLQuery('TRUNCATE az2_implicit_az');
         } catch (DatabaseException $e) {
         }
         try {
             $query = new GenericSQLQuery('TRUNCATE az2_explicit_az');
         } catch (DatabaseException $e) {
         }
         try {
             $query = new GenericSQLQuery('TRUNCATE az2_node_ancestry');
         } catch (DatabaseException $e) {
         }
         try {
             $query = new GenericSQLQuery('TRUNCATE az2_j_node_node');
         } catch (DatabaseException $e) {
         }
         try {
             $query = new GenericSQLQuery('TRUNCATE az2_function');
         } catch (DatabaseException $e) {
         }
         try {
             $query = new GenericSQLQuery('TRUNCATE az2_function_type');
         } catch (DatabaseException $e) {
         }
         try {
             $query = new GenericSQLQuery('TRUNCATE az2_node');
         } catch (DatabaseException $e) {
         }
         try {
             $query = new GenericSQLQuery('TRUNCATE az2_node_type');
         } catch (DatabaseException $e) {
         }
         try {
             $query = new GenericSQLQuery('TRUNCATE az2_hierarchy');
         } catch (DatabaseException $e) {
         }
         $query = new GenericSQLQuery('DROP TABLE az2_implicit_az, az2_explicit_az, az2_function, az2_function_type, az2_node_ancestry, az2_j_node_node, az2_node, az2_node_type,  az2_hierarchy;');
         $dbc->query($query, IMPORTER_CONNECTION);
         return false;
     }
     /*********************************************************
      * If we have successfully gotten this far, drop the old 
      * hierarchy and AuthZ tables to prevent confusion.
      *********************************************************/
     $query = new GenericSQLQuery('DROP TABLE az_authorization, az_function, hierarchy, j_node_node, node, node_ancestry;');
     $dbc->query($query, IMPORTER_CONNECTION);
     return true;
 }
开发者ID:adamfranco,项目名称:segue,代码行数:101,代码来源:Update007_AuthZ2.act.php

示例11: updateAssetParent

 /**
  * Update the asset parent based on values from the wizard.
  * 
  * @param array $results
  * @param object Asset $asset
  * @return void
  * @access public
  * @since 10/26/05
  */
 function updateAssetParent($results, $asset)
 {
     $idManager = Services::getService("Id");
     $authZManager = Services::getService("AuthZ");
     // remove the parents if requested.
     try {
         $parents = $asset->getParents();
         if ($parents->hasNext() && $results == 'NONE') {
             printpre("<hr/>Removing Parents:");
             while ($parents->hasNext()) {
                 $parent = $parents->next();
                 if ($authZManager->isUserAuthorized($idManager->getId("edu.middlebury.authorization.remove_children"), $parent->getId())) {
                     printpre("Removing from: ");
                     printpre($parent->getId());
                     $parent->removeAsset($asset->getId(), TRUE);
                 } else {
                     printpre("No Authorization to remove from: ");
                     printpre($parent->getId());
                 }
             }
             return;
         }
         // Change parents if needed
         if ($results && $results != 'NONE') {
             $newParentId = $idManager->getId($results);
             printpre("<hr/>Trying to change or add Parents:");
             //verify the current parent and change parents if needed.
             if ($parents->hasNext()) {
                 $parent = $parents->next();
                 if (!$newParentId->isEqual($parent->getId()) && $authZManager->isUserAuthorized($idManager->getId("edu.middlebury.authorization.remove_children"), $parent->getId()) && $authZManager->isUserAuthorized($idManager->getId("edu.middlebury.authorization.add_children"), $newParentId)) {
                     printpre("Changing parents from: ");
                     printpre($parent->getId());
                     printpre("To: ");
                     printpre($newParentId);
                     $parent->removeAsset($asset->getId(), TRUE);
                     $repository = $asset->getRepository();
                     $newParent = $repository->getAsset($newParentId);
                     $newParent->addAsset($asset->getId());
                 }
             } else {
                 if ($authZManager->isUserAuthorized($idManager->getId("edu.middlebury.authorization.add_children"), $newParentId)) {
                     printpre("Changing parents from NONE to: ");
                     printpre($newParentId);
                     $repository = $asset->getRepository();
                     $newParent = $repository->getAsset($newParentId);
                     $newParent->addAsset($asset->getId());
                 }
             }
         }
     } catch (UnimplementedException $e) {
         $this->saveMessages[] = _("Could not change Asset parent.") . " " . _("Not supported by this repository.");
     } catch (UnauthorizedException $e) {
         $this->saveMessages[] = _("Could not change Asset parent.") . " " . _("Unauthorized.");
     }
 }
开发者ID:adamfranco,项目名称:concerto,代码行数:64,代码来源:AssetEditingAction.class.php

示例12: saveWizard

 /**
  * Save our results. Tearing down and unsetting the Wizard is handled by
  * in {@link runWizard()} and does not need to be implemented here.
  * 
  * @param string $cacheName
  * @return boolean TRUE if save was successful and tear-down/cleanup of the
  *		Wizard should ensue.
  * @access public
  * @since 4/28/05
  */
 function saveWizard($cacheName)
 {
     $wizard = $this->getWizard($cacheName);
     // Make sure we have a valid Repository
     $courseManager = Services::getService("CourseManagement");
     $idManager = Services::getService("Id");
     $courseManagementId = $idManager->getId("edu.middlebury.coursemanagement");
     // First, verify that we chose a parent that we can add children to.
     $authZ = Services::getService("AuthZ");
     if ($authZ->isUserAuthorized($idManager->getId("edu.middlebury.authorization.add_children"), $courseManagementId)) {
         $values = $wizard->getAllValues();
         printpre($values);
         $type = new Type("CourseManagement", "edu.middlebury", $values['namedescstep']['keyword'], $values['namedescstep']['description']);
         $courseManager->_typeToIndex($values['namedescstep']['typetype'], $type);
         RequestContext::sendTo($this->getReturnUrl());
         exit;
         return TRUE;
     } else {
         return FALSE;
     }
 }
开发者ID:adamfranco,项目名称:polyphony,代码行数:31,代码来源:createnewtype.act.php

示例13: _error_handler

function _error_handler($num, $str, $file, $line, $context)
{
    if ($num & E_NOTICE) {
        return;
    }
    print "ERROR! ({$num}) {$str}<br/>";
    print "in {$file}:{$line}  --> ";
    var_dump($context);
    print "<p>";
    printpre(print_r(debug_backtrace(), true));
}
开发者ID:adamfranco,项目名称:segue-1.x,代码行数:11,代码来源:functions.inc.php

示例14: harmoni_0_11_0_update

 /**
  * Add the creator column to the dr_asset_info table.
  * 
  * @param int $dbIndex
  * @return void
  * @access public
  * @since 10/8/07
  */
 public static function harmoni_0_11_0_update($dbIndex)
 {
     $dbc = Services::getService("DBHandler");
     // Add the creator column to the dr_asset_info table
     $hasCreator = false;
     $result = $dbc->query(new GenericSQLQuery("DESCRIBE dr_asset_info"), $dbIndex);
     $result = $result->returnAsSelectQueryResult();
     while ($result->hasNext()) {
         if ($result->field("Field") == 'creator') {
             $hasCreator = true;
             break;
         }
         $result->advanceRow();
     }
     if (!$hasCreator) {
         // Alter the table
         printpre("Adding column creator to dr_asset_info");
         $dbc->query(new GenericSQLQuery("ALTER TABLE `dr_asset_info` ADD `creator` VARCHAR( 75 ) AFTER `create_timestamp` ;"), $dbIndex);
     }
 }
开发者ID:adamfranco,项目名称:harmoni,代码行数:28,代码来源:MySqlUtils.class.php

示例15: run

 /**
  * Runs the update
  */
 function run()
 {
     // modify the page_text option
     $query = "\n\t\tDESCRIBE\n\t\t\tpage page_text\n\t\t";
     $r = db_query($query);
     if (db_num_rows($r) < 1) {
         $query = "\n\t\t\tALTER TABLE \n\t\t\t\tpage\n\t\t\tADD \n\t\t\t\tpage_text MEDIUMBLOB AFTER page_created_tstamp\n\t\t\t";
         $r = db_query($query);
     }
     // modify the page_location option
     $query = "\n\t\tDESCRIBE\n\t\t\tpage page_location\n\t\t";
     $r = db_query($query);
     if (db_num_rows($r) < 1) {
         $query = "\n\t\t\tALTER TABLE \n\t\t\t\tpage\n\t\t\tADD \n\t\t\t\tpage_location ENUM('left','right') AFTER page_order\n\t\t\t";
         $r = db_query($query);
     }
     // modify the page_show_editor option
     $query = "\n\t\tDESCRIBE\n\t\t\tpage page_show_editor\n\t\t";
     $r = db_query($query);
     if (db_num_rows($r) < 1) {
         $query = "\n\t\t\tALTER TABLE \n\t\t\t\tpage\n\t\t\tADD \n\t\t\t\tpage_show_editor enum('0', '1') AFTER page_show_creator\n\t\t\t";
         $r = db_query($query);
     }
     // modify the page_display_type in page table
     $query = "\n\t\tDESCRIBE\n\t\t\tpage page_display_type\n\t\t";
     $r = db_query($query);
     $a = db_fetch_assoc($r);
     if (!eregi("(enum\\()(.*'content'.*)(\\))", $a['Type']) && eregi("enum\\((.*)\\)", $a['Type'], $parts)) {
         printpre($a['Null']);
         $query = "\n\t\t\tALTER TABLE \n\t\t\t\tpage\n\t\t\tCHANGE \n\t\t\t\tpage_display_type page_display_type  \n\t\t\t\t\tENUM(" . $parts[1] . ",'content','tags','rss','participants') \n\t\t\t\t\tDEFAULT '" . $a['Default'] . "' \n\t\t\t\t\t" . ($a['Null'] ? "" : "NOT") . " NULL\n\t\t\t";
         $r = db_query($query);
     }
     // add tags table and move all category info into tags table
     $query = "\n\t\tDESCRIBE\n\t\t\ttags\n\t\t";
     $r = db_query($query);
     if (db_num_rows($r) < 1) {
         $query = "\n\t\t\tCREATE TABLE `tags` (\n\t\t\t  `record_type` varchar(128) NOT NULL default '',\n\t\t\t  `FK_record_id` int(11) NOT NULL default '0',\n\t\t\t  `FK_user_id` int(11) NOT NULL default '0',\n\t\t\t  `record_tag` varchar(255) NOT NULL default '',\n\t\t\t  `record_tag_added` timestamp(14) NOT NULL,\n\t\t\t  KEY `FK_record_id` (`FK_record_id`),\n\t\t\t  KEY `FK_user_id` (`FK_user_id`),\n\t\t\t  KEY `record_type` (`record_type`(7)),\n\t\t\t  KEY `record_tag` (`record_tag`(10))\n\t\t\t) TYPE=MyISAM;\n\t\t\t";
         $r = db_query($query);
     }
     // find all stories with category info
     $query = "\n\t\tSELECT * \n\t\tFROM  story \n\t\tWHERE  story_category LIKE  '%_'\n\t\t";
     $r = db_query($query);
     // move category info to tags table
     while ($a = db_fetch_assoc($r)) {
         $category = $a['story_category'];
         $record_tag = urlencode(ereg_replace(" ", "_", $category));
         $FK_record_id = $a['story_id'];
         $FK_user_id = $a['FK_createdby'];
         $query02 = "\n\t\t\tINSERT INTO \n\t\t\t\ttags\n\t\t\t\t(`record_type`, `FK_record_id`, `FK_user_id`, `record_tag`, `record_tag_added`) \n\t\t\t\tVALUES \n\t\t\t\t('story',  '{$FK_record_id}',  '{$FK_user_id}',  '{$record_tag}', NOW())\n\t\t\t";
         $r02 = db_query($query02);
     }
 }
开发者ID:adamfranco,项目名称:segue-1.x,代码行数:55,代码来源:update_1.5.0.inc.php


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