public function backup(array $data, $model)
    {
        $directory = gplcart_file_private_module('backup');

        if (!file_exists($directory) && !mkdir($directory, 0775, true)) {
            return false;
        }

        $data['type'] = 'module';
        $data['name'] = $this->translation->text('Module @name', array('@name' => $data['name']));

        $time = date('d-m-Y--G-i');
        $destination = gplcart_file_unique("$directory/module-{$data['id']}-$time.zip");
        $data['path'] = gplcart_file_relative($destination);

        $success = $this->zip->directory($data['directory'], $destination, $data['id']);

        if ($success) {
            return (bool) $model->add($data);
        }

        return false;
    }
public function backup(array $data, $model)
    {
        $directory = gplcart_file_private_module('backup');

        if (!file_exists($directory) && !mkdir($directory, 0775, true)) {
            return false;
        }

        $data['type'] = 'module';
        $data['name'] = $this->translation->text('Module @name', array('@name' => $data['name']));

        $time = date('d-m-Y--G-i');
        $destination = gplcart_file_unique("$directory/module-{$data['id']}-$time.zip");
        $data['path'] = gplcart_file_relative($destination);

        $success = $this->zip->directory($data['directory'], $destination, $data['id']);

        if ($success) {
            return (bool) $model->add($data);
        }

        return false;
    }
public function backup ( array $ data , $ model ) { $ directory = gplcart_file_private_module ( 'backup' ) ; if ( ! file_exists ( $ directory ) && ! mkdir ( $ directory , 0775 , true ) ) { return false ; } $ data [ 'type' ] = 'module' ; $ data [ 'name' ] = $ this -> translation -> text ( 'Module @name' , array ( '@name' => $ data [ 'name' ] ) ) ; $ time = date ( 'd-m-Y--G-i' ) ; $ destination = gplcart_file_unique ( "$directory/module-{$data['id']}-$time.zip" ) ; $ data [ 'path' ] = gplcart_file_relative ( $ destination ) ; $ success = $ this -> zip -> directory ( $ data [ 'directory' ] , $ destination , $ data [ 'id' ] ) ; if ( $ success ) { return ( bool ) $ model -> add ( $ data ) ; } return false ; }
Creates a module backup
@param array $data
@param \gplcart\modules\backup\models\Backup $model
@return boolean
Creates a module backup