/** * @brief Performs the ownCloud install. * @return string with error messages */ public static function install() { $error = ''; // downloading latest release $error .= oc_setup::getfile('http://download.owncloud.com/download/community/owncloud-latest.zip', 'oc.zip'); // unpacking into owncloud folder $zip = new ZipArchive(); $res = $zip->open('oc.zip'); if ($res == true) { $zip->extractTo('.'); $zip->close(); } else { $error .= 'unzip of owncloud source file failed.<br />'; } // deleting tar file $result = @unlink('oc.zip'); if ($result == false) { $error .= 'deleting of oc.zip failed.<br />'; } return $error; }
/** * @brief Performs the ownCloud install. * @return string with error messages */ static public function install() { $error=''; // downloading latest release if (!file_exists('oc.zip')) { $error.=oc_setup::getfile('https://download.owncloud.org/download/community/owncloud-latest.zip','oc.zip'); } // unpacking into owncloud folder $zip = new ZipArchive; $res = $zip->open('oc.zip'); if ($res==true) { // Extract it to the tmp dir $owncloud_tmp_dir = 'tmp-owncloud'.time(); $zip->extractTo($owncloud_tmp_dir); $zip->close(); // Move it to the folder if ($_GET['directory'] === '.') { foreach (array_diff(scandir($owncloud_tmp_dir.'/owncloud'), array('..', '.')) as $item) { rename($owncloud_tmp_dir.'/owncloud/'.$item, './'.$item); } rmdir($owncloud_tmp_dir.'/owncloud'); } else { rename($owncloud_tmp_dir.'/owncloud', './'.$_GET['directory']); } // Delete the tmp folder rmdir($owncloud_tmp_dir); } else { $error.='unzip of owncloud source file failed.<br />'; } // deleting zip file $result=@unlink('oc.zip'); if($result==false) $error.='deleting of oc.zip failed.<br />'; return($error); }