コード例 #1
0
ファイル: application.php プロジェクト: noccy80/lepton-ng
 /**
  * @brief Fork the process, sending it to the background.
  * 
  * Remember to check the return value in order to figure out if the fork
  * was successful, and exit your application gracefully if true. This
  * method does NOT return the new pid. Use getLastPid() to retrieve the
  * pid of the new child process.
  * 
  * @param boolean $quiet If false, the fork status will be displayed
  * @return boolean True in the forked code, false in code calling fork.
  */
 protected function fork($quiet = true)
 {
     $pid = pcntl_fork();
     if ($pid == -1) {
         throw new CriticalException("pcntl_fork() failed!");
     } elseif ($pid == 0) {
         $this->servicemain();
         return true;
     } else {
         $this->_last_pid = $pid;
         if (!$quiet) {
             Console::writeLn("Forked to new pid %d", $pid);
         }
         return false;
     }
 }
コード例 #2
0
ファイル: model.php プロジェクト: noccy80/lepton-ng
 public function inspect()
 {
     Console::writeLn('Inspecting model %s:', $this->model);
     foreach ($this->_data as $field => $data) {
         Console::writeLn('  %s = %s', $field, $data);
     }
 }
コード例 #3
0
ファイル: info.php プロジェクト: noccy80/lepton-ng
 function extensions()
 {
     $cb = 0;
     Console::writeLn(__astr("\\b{Loaded extensions:}"));
     $ext = get_loaded_extensions();
     sort($ext);
     foreach ($ext as $val) {
         Console::write('  %-18s', $val);
         $cb++;
         if ($cb > 3 && $val != end($ext)) {
             Console::writeLn();
             $cb = 0;
         }
     }
     Console::writeLn();
     Console::writeLn();
 }
コード例 #4
0
ファイル: baseactions.php プロジェクト: noccy80/lepton-ng
 function config()
 {
     Console::write("Reading configuration metadata ... ");
     Console::status('dbx           ');
     sleep(1);
     Console::status('dbx.db        ');
     sleep(1);
     Console::status('dbx.db.mysql  ');
     sleep(1);
     Console::writeLn('done          ');
     Console::writeLn("Parsing configuration file ... done");
     Console::writeLn("Preparing options ... done");
 }
コード例 #5
0
ファイル: l2package.php プロジェクト: noccy80/lepton-ng
 public function getFiles()
 {
     Console::write("Reading file database: ");
     $fn = 'zip://' . $this->packagename . '#' . $this->filedb;
     Console::write("%s ... ", $fn);
     $fh = fopen($fn, 'r');
     $files = array();
     while (!feof($fh)) {
         $fl = fgets($fh);
         while (strpos($fl, "  ") !== false) {
             $fl = str_replace("  ", " ", $fl);
         }
         $fd = explode(" ", str_replace("\n", "", $fl));
         $files[] = array('filename' => $fd[1], 'md5' => $fd[0]);
     }
     Console::writeLn("Done");
     return $files;
 }