コード例 #1
0
ファイル: cb.dbchecker.php プロジェクト: rkern21/videoeditor
	/**
	 * Returns all logs logged
	 *
	 * @param  string|boolean  $implode         False: returns full array, if string: imploding string
	 * @param  string|boolean  $detailsImplode  False: no details, otherwise imploding string
	 * @return string|array
	 */
	function getLogs( $implode = "\n", $detailsImplode = false ) {
		return $this->_sqlUpgrader->getLogs( $implode, $detailsImplode );		
	}
コード例 #2
0
 /**
  * Checks the plugin's database tables and upgrades if needed
  * Backend-use only.
  *
  * Sets for $this->getErrors() $this->checkdbErrors and for $this->getLogs() $this->checkdbLogs
  *
  * @param  int             $pluginId
  * @param  boolean         $upgrade    False: only check table, True: upgrades table (depending on $dryRun)
  * @param  boolean         $dryRun     True: doesn't do the modifying queries, but lists them, False: does the job
  * @return boolean|string              True: success: see logs, False: error, see errors, string: error
  */
 function checkDatabase($pluginId, $upgrade = false, $dryRun = false)
 {
     global $_CB_database;
     $success = null;
     $cbInstallXML = $this->getXml($pluginId);
     if (is_object($cbInstallXML)) {
         $db =& $cbInstallXML->getElementByPath('database');
         if ($db) {
             // get the element name:
             $e =& $cbInstallXML->getElementByPath('name');
             $this->elementName($e->data());
             $cleanedElementName = strtolower(str_replace(array(" ", "."), array("", "_"), $this->elementName()));
             cbimport('cb.sql.upgrader');
             $sqlUpgrader = new CBSQLupgrader($_CB_database, false);
             $sqlUpgrader->setDryRun($dryRun);
             $success = $sqlUpgrader->checkXmlDatabaseDescription($db, $cleanedElementName, $upgrade, null);
             /*
             var_dump( $success );
             echo "<br>\nERRORS: " . $sqlUpgrader->getErrors( "<br /><br />\n\n", "<br />\n" );
             echo "<br>\nLOGS: " . $sqlUpgrader->getLogs( "<br /><br />\n\n", "<br />\n" );
             exit;
             */
             $this->checkdbErrors = $sqlUpgrader->getErrors(false);
             $this->checkdbLogs = $sqlUpgrader->getLogs(false);
         }
     } else {
         $success = $cbInstallXML;
     }
     return $success;
 }