frontend/modules/elfind/src/elFinderVolumeLocalFileSystem.class.php
/**
     * restoreDeletedFileCE for file or directory
     *
     * @param string $path
     * @return array
     */
restoreDeletedFileCE for file or directory
@param string $path
@return array
restoreDeletedFileCE for file or directory @param string $path @return array
protected function restoreDeletedFileCE($path)
    {
        $UserNode = $this->getUserNode();
        if (!$UserNode) {
            return ['result' => "error", 'info' => "User not found!"];
        }
        if (!file_exists($path)) {
            return ['result' => "error", 'info' => self::ERROR_SYNCHRONIZATION];
        }
        try {
            $tmp1 = @unserialize(file_get_contents($path));
            if (!isset($tmp1['file_uuid'], $tmp1['file_id'])) {
                return ['result' => "error", 'info' => self::ERROR_SYNCHRONIZATION];
            }
        } catch (Exception $e) {
            return ['result' => "error", 'info' => self::ERROR_SYNCHRONIZATION];
        }
        $data['last_event_id'] = UserFiles::last_event_id($tmp1['file_id']);
        if (!$data['last_event_id'] || $data['last_event_id'] == 0) {
            return ['result' => "error", 'info' => "last_event_id error."];
        }
        $data['file_uuid']       = $tmp1['file_uuid'];
        $model = new NodeApi(['file_uuid', 'last_event_id']);
        if (!$model->load(['NodeApi' => $data]) || !$model->validate()) {
            $err = $model->getErrors();
            $err_txt = self::getErrTxt($err);
            return ['result' => "error", 'info' => $err_txt];
        }
        $ret = $model->file_event_restore($UserNode, false, false);
        if ($ret['result'] === 'success') {
            return [
                'status'     => true,
                'restored'   => [$this->encode($path)],
                'event_data' => isset($ret['event_data']) ? $ret['event_data'] : [],
            ];
        } else {
            return [
                'status' => false,
                'info'   => $ret['info'],
            ];
        }
    }
protected function restoreDeletedFileCE ( $ path ) { $ UserNode = $ this -> getUserNode ( ) ; if ( ! $ UserNode ) { return [ 'result' => " error " , 'info' => " User not found! " ] ; } if ( ! file_exists ( $ path ) ) { return [ 'result' => " error " , 'info' => self :: ERROR_SYNCHRONIZATION ] ; } try { $ tmp1 = @ unserialize ( file_get_contents ( $ path ) ) ; if ( ! isset ( $ tmp1 [ 'file_uuid' ] , $ tmp1 [ 'file_id' ] ) ) { return [ 'result' => " error " , 'info' => self :: ERROR_SYNCHRONIZATION ] ; } } catch ( Exception $ e ) { return [ 'result' => " error " , 'info' => self :: ERROR_SYNCHRONIZATION ] ; } $ data [ 'last_event_id' ] = UserFiles :: last_event_id ( $ tmp1 [ 'file_id' ] ) ; if ( ! $ data [ 'last_event_id' ] || $ data [ 'last_event_id' ] == 0 ) { return [ 'result' => " error " , 'info' => " last_event_id error. " ] ; } $ data [ 'file_uuid' ] = $ tmp1 [ 'file_uuid' ] ; $ model = new NodeApi ( [ 'file_uuid' , 'last_event_id' ] ) ; if ( ! $ model -> load ( [ 'NodeApi' => $ data ] ) || ! $ model -> validate ( ) ) { $ err = $ model -> getErrors ( ) ; $ err_txt = self :: getErrTxt ( $ err ) ; return [ 'result' => " error " , 'info' => $ err_txt ] ; } $ ret = $ model -> file_event_restore ( $ UserNode , false , false ) ; if ( $ ret [ 'result' ] === 'success' ) { return [ 'status' => true , 'restored' => [ $ this -> encode ( $ path ) ] , 'event_data' => isset ( $ ret [ 'event_data' ] ) ? $ ret [ 'event_data' ] : [ ] , ] ; } else { return [ 'status' => false , 'info' => $ ret [ 'info' ] , ] ; } }
restoreDeletedFileCE for file or directory
 @param string $path
 @return array
restoreDeletedFileCE for file or directory @param string $path @return array
//var_dump($model->getErrors()); exit;