예제 #1
0
 function shutdown($exitCode = false, $exitText = false)
 {
     $cli = eZCLI::instance();
     if (class_exists('eZDB') and eZDB::hasInstance()) {
         $db = eZDB::instance(false, array('show_errors' => false));
         // Perform transaction check
         $transactionCounterCheck = eZDB::checkTransactionCounter();
         if (isset($transactionCounterCheck['error'])) {
             $cli->error($transactionCounterCheck['error']);
         }
         if ($this->UseSession and $db->isConnected()) {
             eZUser::logoutCurrent();
             eZSession::remove();
         }
     }
     $webOutput = $cli->isWebOutput();
     if ($this->UseDebugOutput or eZDebug::isDebugEnabled()) {
         if ($this->DebugMessage) {
             fputs(STDERR, $this->DebugMessage);
         }
         fputs(STDERR, eZDebug::printReport(false, $webOutput, true, $this->AllowedDebugLevels, $this->UseDebugAccumulators, $this->UseDebugTimingPoints, $this->UseIncludeFiles));
     }
     eZExecution::cleanup();
     eZExecution::setCleanExit();
     $this->setIsInitialized(false);
     if ($exitCode !== false) {
         $this->ExitCode = $exitCode;
     }
     if ($this->ExitCode !== false) {
         if ($exitText !== false) {
             $cli->output($exitText);
         }
         exit($this->ExitCode);
     }
 }