iaPatchApplier::getLog PHP Method

getLog() public method

public getLog ( )
    public function getLog()
    {
        $output = '';
        if ($this->_log) {
            foreach ($this->_log as $entry) {
                $output .= strtoupper($entry['type']) . ' ' . $entry['message'] . PHP_EOL;
            }
        }
        return $output;
    }

Usage Example

Ejemplo n.º 1
0
 public static function forceUpgrade($version)
 {
     iaCore::instance()->factory('util');
     $patchUrl = iaUtil::REMOTE_TOOLS_URL . 'get/patch/%s/%s/';
     $patchUrl = sprintf($patchUrl, IA_VERSION, $version);
     $filePath = IA_TMP . 'patch.iap';
     iaUtil::downloadRemoteContent($patchUrl, $filePath);
     if ($contents = file_get_contents($filePath)) {
         require_once IA_HOME . 'install/classes/ia.patch.parser.php';
         require_once IA_HOME . 'install/classes/ia.patch.applier.php';
         try {
             $iaPatchParser = new iaPatchParser($contents);
             $patch = $iaPatchParser->patch;
             $iaPatchApplier = new iaPatchApplier(IA_HOME, array('host' => INTELLI_DBHOST . ':' . INTELLI_DBPORT, 'database' => INTELLI_DBNAME, 'user' => INTELLI_DBUSER, 'password' => INTELLI_DBPASS, 'prefix' => INTELLI_DBPREFIX), true);
             $iaPatchApplier->process($patch, $version);
             $logFile = 'upgrade-log-' . $patch['info']['version_to'] . '_' . date('d-m-y-Hi') . '.txt';
             if ($fh = fopen(IA_UPLOADS . $logFile, 'wt')) {
                 fwrite($fh, $iaPatchApplier->getLog());
                 fclose($fh);
             }
             $logParams = array('type' => 'app-forced', 'from' => IA_VERSION, 'to' => $version, 'file' => $logFile);
             $iaLog = iaCore::instance()->factory('log');
             $iaLog->write(iaLog::ACTION_UPGRADE, $logParams);
             return true;
         } catch (Exception $e) {
             return $e->getMessage();
         }
     }
     return false;
 }
All Usage Examples Of iaPatchApplier::getLog