mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 07:23:13 +00:00
Remove system file class
This commit is contained in:
@@ -75,6 +75,8 @@ class module_console_systemExport extends Command
|
||||
|
||||
public function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$core = \bootstrap::getCore();
|
||||
|
||||
$docPerDir = max(1, (int) $input->getOption('docperdir'));
|
||||
|
||||
/**
|
||||
@@ -167,7 +169,7 @@ class module_console_systemExport extends Command
|
||||
. '/' . $unicode->remove_nonazAZ09($databox->get_viewname(), true, true)
|
||||
. '/';
|
||||
|
||||
system_file::mkdir($local_export);
|
||||
$core['file-system']->mkdir($local_export);
|
||||
|
||||
$sql = 'SELECT record_id FROM record WHERE parent_record_id = 0 ';
|
||||
|
||||
@@ -201,7 +203,7 @@ class module_console_systemExport extends Command
|
||||
$dir_increment ++;
|
||||
$in_dir_files = array();
|
||||
$current_dir = $local_export . sprintf($dir_format, $dir_increment) . '/';
|
||||
system_file::mkdir($current_dir);
|
||||
$core['file-system']->mkdir($current_dir);
|
||||
}
|
||||
|
||||
if ($sanitize) {
|
||||
@@ -250,16 +252,14 @@ class module_console_systemExport extends Command
|
||||
|
||||
protected function processRecords(\record_adapter $record, $outfile, $caption)
|
||||
{
|
||||
|
||||
try {
|
||||
$file = new system_file($record->get_subdef('document')->get_pathfile());
|
||||
} catch (\Exception_Media_SubdefNotFound $e) {
|
||||
if ( ! file_exists($record->get_subdef('document')->get_pathfile())) {
|
||||
return false;
|
||||
}
|
||||
$core = \bootstrap::getCore();
|
||||
|
||||
copy($file->getPathname(), $outfile);
|
||||
$core['file-system']->copy($record->get_subdef('document')->get_pathfile(), $outfile);
|
||||
|
||||
$dest_file = new system_file($outfile);
|
||||
$dest_file = new \SplFileInfo($outfile);
|
||||
|
||||
touch(
|
||||
$dest_file->getPathname()
|
||||
|
@@ -9,6 +9,8 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use MediaVorus\Media\Media;
|
||||
|
||||
/**
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
@@ -81,7 +83,7 @@ interface record_Interface
|
||||
|
||||
public function get_sbas_id();
|
||||
|
||||
public function substitute_subdef($name, system_file $pathfile);
|
||||
public function substitute_subdef($name, Media $media);
|
||||
|
||||
public function set_metadatas(Array $metadatas, $force_readonly = false);
|
||||
|
||||
|
@@ -393,6 +393,7 @@ class set_export extends set_abstract
|
||||
|
||||
$includeBusinessFields = ! ! $includeBusinessFields;
|
||||
|
||||
$core = \bootstrap::getCore();
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$session = $appbox->get_session();
|
||||
$registry = $appbox->get_registry();
|
||||
@@ -406,7 +407,7 @@ class set_export extends set_abstract
|
||||
$file_names = array();
|
||||
|
||||
$size = 0;
|
||||
$user = User_Adapter::getInstance($session->get_usr_id(), $appbox);
|
||||
$user = $core->getAuthenticatedUser();
|
||||
|
||||
foreach ($this->elements as $download_element) {
|
||||
$id = count($files);
|
||||
@@ -639,7 +640,7 @@ class set_export extends set_abstract
|
||||
. time() . $session->get_usr_id()
|
||||
. $session->get_ses_id() . '/';
|
||||
|
||||
system_file::mkdir($caption_dir);
|
||||
$core['file-system']->mkdir($caption_dir, 0750);
|
||||
|
||||
$desc = $download_element->get_caption()->serialize(\caption_record::SERIALIZE_XML, $BF);
|
||||
|
||||
@@ -660,7 +661,8 @@ class set_export extends set_abstract
|
||||
$caption_dir = $registry->get('GV_RootPath') . 'tmp/desc_tmp/'
|
||||
. time() . $session->get_usr_id()
|
||||
. $session->get_ses_id() . '/';
|
||||
system_file::mkdir($caption_dir);
|
||||
|
||||
$core['file-system']->mkdir($caption_dir, 0750);
|
||||
|
||||
$desc = $download_element->get_caption()->serialize(\caption_record::SERIALIZE_YAML, $BF);
|
||||
|
||||
@@ -699,6 +701,8 @@ class set_export extends set_abstract
|
||||
*/
|
||||
public static function build_zip($token, Array $list, $zipFile)
|
||||
{
|
||||
$core = bootstrap::getCore();
|
||||
|
||||
$zip = new ZipArchiveImproved();
|
||||
|
||||
if ($zip->open($zipFile, ZIPARCHIVE::CREATE) !== true) {
|
||||
@@ -715,12 +719,7 @@ class set_export extends set_abstract
|
||||
|
||||
random::updateToken($token, serialize($list));
|
||||
|
||||
$str_in = array("à", "á", "â", "ã", "ä", "å", "ç", "è", "é", "ê",
|
||||
"ë", "ì", "í", "î", "ï", "ð", "ñ", "ò", "ó", "ô",
|
||||
"õ", "ö", "ù", "ú", "û", "ü", "ý", "ÿ");
|
||||
$str_out = array("a", "a", "a", "a", "a", "a", "c", "e", "e", "e",
|
||||
"e", "i", "i", "i", "i", "o", "n", "o", "o", "o",
|
||||
"o", "o", "u", "u", "u", "u", "y", "y");
|
||||
$unicode = new \unicode();
|
||||
|
||||
$caption_dirs = $unlinks = array();
|
||||
|
||||
@@ -734,7 +733,7 @@ class set_export extends set_abstract
|
||||
. $obj["ajout"]
|
||||
. '.' . $obj["exportExt"];
|
||||
|
||||
$name = str_replace($str_in, $str_out, $name);
|
||||
$name = $unicode->remove_diacritics($name);
|
||||
|
||||
$zip->addFile($path, $name);
|
||||
|
||||
@@ -751,6 +750,7 @@ class set_export extends set_abstract
|
||||
$zip->close();
|
||||
|
||||
$list['complete'] = true;
|
||||
$unicode = null;
|
||||
|
||||
random::updateToken($token, serialize($list));
|
||||
|
||||
@@ -761,8 +761,7 @@ class set_export extends set_abstract
|
||||
@rmdir($c);
|
||||
}
|
||||
|
||||
$system_file = new system_file($zipFile);
|
||||
$system_file->chmod();
|
||||
$core['file-system']->chmod($zipFile, 0760);
|
||||
|
||||
return $zipFile;
|
||||
}
|
||||
|
Reference in New Issue
Block a user