예제 #1
0
 public function testMaxTweetsOnFirstPage()
 {
     $model = $this->getModelThatReturns(0);
     $twitter = $this->getTwitterReturns200Tweets();
     $archiver = new Archiver($this->username, $twitter, $model);
     $output = $archiver->archive();
     $this->assertTrue($this->didFindString($output, '200 tweets on page 1'));
 }
예제 #2
0
 /**
  * Grabs all the latest tweets and puts them into the database.
  *
  * @return string Returns a string with informational output.
  */
 public function archive()
 {
     // create twitter instance
     $twitter = new \TijsVerkoyen\Twitter\Twitter($this->config['auth']['consumerKey'], $this->config['auth']['consumerSecret']);
     $twitter->setOAuthToken($this->config['auth']['oauthToken']);
     $twitter->setOAuthTokenSecret($this->config['auth']['oauthSecret']);
     $archiver = new Archiver($this->config['twitter']['username'], $twitter, $this->model);
     return $archiver->archive();
 }
예제 #3
0
 /**
  * Build tar gzip archive file.
  *
  * @return true|false Whether successful or not.
  */
 public function build()
 {
     // Patch config file first
     $this->patchConfigFile();
     // Patch package.xml file
     $files = $this->patchPackageFile();
     // Create tgz archive
     $archiver = new Archiver($this->name . '-' . $this->version . '.tgz');
     // add all files defined in package.xml file
     foreach ($files as $file) {
         $archiver->addFile($file, str_replace($this->packageDir, '', $file));
     }
     // add package.xml
     $archiver->addFile($this->packageFile, str_replace($this->packageDir, '', $this->packageFile));
     $archiver->compress();
     $this->log[] = $this->name . '-' . $this->version . '.tgz created';
     return implode($this->log, "\n");
 }
예제 #4
0
 private function getPackedArchive()
 {
     global $projectTmpDir;
     $logFilename = $projectTmpDir . '/scan_log.xml';
     $packedLogFilename = $logFilename . '.zip';
     if (!is_file($logFilename)) {
         die(PS_ERR_NO_DOWNLOAD_LOG_FILE);
     }
     $xml_data = file_get_contents($logFilename);
     $archiver = new Archiver($packedLogFilename, 'a');
     $archiver->createFile(basename($logFilename), $xml_data);
     $quarantineFilepathFilepath = $projectTmpDir . '/malware_quarantine_filepath.tmp.txt';
     if (file_exists($quarantineFilepathFilepath)) {
         $quarantineFilepath = file_get_contents($quarantineFilepathFilepath);
         $archiver->addFile($quarantineFilepath, basename($quarantineFilepath));
         unlink($quarantineFilepathFilepath);
     }
     $archiver->close();
     $this->streamFileContent($packedLogFilename, true);
     unlink($logFilename);
 }
예제 #5
0
 /**
  * Step 2: archive and display
  */
 public function step2()
 {
     // run the archiver
     $archiver = new Archiver($this->data['form']['twitterUsername'], $this->twitter, $this->model);
     $this->data['archiverOutput'] = $archiver->archive();
     $this->data['content'] = $this->view->render('install02.php', $this->data, true);
     $this->view->render('_layout.php', $this->data);
 }
 function SymbolListArchiver($opts = null)
 {
     parent::Archiver($opts);
     return $this;
 }