示例#1
0
文件: Plugin.php 项目: Laxa/Nimda3
 public final function addJob($callback, $data = null)
 {
     $filename = libCrypt::getRandomHash() . '.nimdajob';
     $data = array('classname' => get_class($this), 'origin' => array('plugin' => $this->id, 'server' => $this->Server ? $this->Server->id : false, 'channel' => $this->Channel ? $this->Channel->id : false, 'user' => $this->User ? $this->User->id : false, 'command' => $this->command ? $this->command : false), 'callback' => $callback, 'plugin_path' => 'plugins/' . (libString::startsWith('CorePlugin', get_class($this)) ? 'core' : 'user') . '/' . get_class($this) . '.php', 'job_done_filename' => $this->Bot->getTempDir() . '/jobs_done/' . $filename, 'data' => $data);
     $filepath = $this->Bot->getTempDir() . '/jobs/' . $filename;
     file_put_contents($filepath, serialize($data));
     shell_exec('/usr/bin/php ./core/Job.php ' . escapeshellarg($filepath) . ' > /dev/null &');
     $this->Bot->jobCount++;
     if ($this->Bot->jobCount > $this->Bot->jobCountMax) {
         $this->Bot->jobCountMax = $this->Bot->jobCount;
     }
 }
示例#2
0
文件: Nimda.php 项目: Laxa/Nimda3
 private function createTempDir()
 {
     $this->tempDir = sys_get_temp_dir() . '/nimda-' . libCrypt::getRandomHash();
     mkdir($this->tempDir);
     chmod($this->tempDir, 0700);
     mkdir($this->tempDir . '/cache');
     mkdir($this->tempDir . '/jobs');
     mkdir($this->tempDir . '/jobs_done');
 }