Example #1
0
 /**
  * Perform the action.
  *
  * @param EcrProjectZiper $ziper
  *
  * @return \EcrProjectAction
  */
 public function run(EcrProjectZiper $ziper)
 {
     $project = EcrProjectHelper::getProject();
     $updateserver = new EcrProjectUpdateserver($project);
     $fileList = $ziper->getCreatedFiles();
     if (0 == count($fileList)) {
         return $this->abort('ERROR: No files to transfer', $ziper);
     }
     $path = ECRPATH_UPDATESERVER . '/' . $project->comName . '/' . $this->releaseState;
     $urlPath = ECRPATH_UPDATESERVER_URL . '/' . $project->comName . '/' . $this->releaseState;
     $urls = array();
     /* @ var EcrProjectZiperCreatedfile $f */
     foreach ($fileList as $f) {
         $dest = $path . '/' . $f->name;
         if (false == JFile::copy($f->path, $dest)) {
             return $this->abort(sprintf('ERROR: Can not copy the file %s to %s', $f->path, $dest), $ziper);
         }
         $ziper->logger->log(sprintf('The file<br />%s<br />has been copied to<br />%s', $f->path, $dest));
         $alternate = $f->alternateDownload;
         $urls[] = $alternate ?: $urlPath . '/' . $f->name;
     }
     $release = new EcrProjectUpdateserverRelease();
     $release->state = $this->releaseState;
     $release->downloads = $urls;
     $release->description = 'Bescreibung...';
     $updateserver->addRelease($release);
     return $this;
 }
Example #2
0
<?php

/**
 * User: elkuku
 * Date: 08.06.12
 * Time: 10:14
 */
echo date(DATE_ATOM);
$u = new EcrProjectUpdateserver($this->project);
$u->create($this->project);
echo '<pre>';
$f = new EcrProjectFeed();
$f->title = 'Der erste Feed';
$f->link = 'http://qqq';
$f->description = 'Die erste Beschreibung';
$i = new EcrProjectFeedItem();
$i->title = 'Item titel';
$i->description = 'Item Besxchreibung';
$i->link = 'http://yyyy';
$f->addItem($i);
echo htmlentities($f);
echo "\n\n";
echo htmlentities($f->printPretty());
echo '</pre>';