Пример #1
0
 function upload($incVersion)
 {
     $vs = qg::remoteGet($this->name);
     if (!is_dir(sysPATH . $this->name)) {
         return false;
     }
     $v = explode('.', $vs['version']);
     $v = @array((int) $v[0], (int) $v[1], (int) $v[2]);
     foreach ($v as $i => $vp) {
         if ($i >= $incVersion) {
             $v[$i] = 0;
         }
     }
     isset($v[$incVersion - 1]) && ++$v[$incVersion - 1];
     $vs['version'] = implode('.', $v);
     $tmpFile = appPATH . 'cache/tmp/module_export1.zip';
     is_file($tmpFile) && unlink($tmpFile);
     // zzz unlink???
     ini_set('max_execution_time', '600');
     $zip = new Zip();
     $zip->open($tmpFile, Zip::CREATE);
     $zip->addDir(sysPATH . $this->name, null, '/(\\.svn)|(zzz)/');
     $zip->close();
     $vs['size'] = filesize($tmpFile);
     $this->local_version = $vs['version'];
     @qg::Ftp()->mkdir('/module/' . $this->name . '/');
     qg::Ftp()->put('/module/' . $this->name . '/' . $vs['version'] . '.zip', $tmpFile, FTP_BINARY);
     qg::remoteSet($this->name, $vs);
     return $vs['version'];
 }