Submit
Path:
~
/
home
/
bfxleof
/
www
/
wp-content
/
plugins
/
duplicator
/
installer
/
File Content:
Revisions.php
<?php /** * Manages revisions (backups) of a file. * Revision file names have form "<filename>-backup-<date>.<ext>~" */ class Loco_fs_Revisions implements Countable/*, IteratorAggregate*/ { /** * @var Loco_fs_File */ private $master; /** * Sortable list of backed up file paths (not including master) * @var array */ private $paths; /** * Cached regular expression for matching backup file paths * @var string */ private $regex; /** * Cached count of backups + 1 * @var int */ private $length; /** * Paths to delete when object removed from memory * @var array */ private $trash = array(); /** * Construct from master file (current version) * @param Loco_fs_File */ public function __construct( Loco_fs_File $file ){ $this->master = $file; } /** * @internal * Executes deferred deletions with silent errors */ public function __destruct(){ if( $trash = $this->trash ){ $writer = clone $this->master->getWriteContext(); foreach( $trash as $file ){ if( $file->exists() ){ try { $writer->setFile($file); $writer->delete(false); } catch( Loco_error_WriteException $e ){ // avoiding fatal error because pruning is non-critical operation Loco_error_AdminNotices::debug( $e->getMessage() ); } } } } } /** * Check that file permissions allow a new backup to be created * @return bool */ public function writable(){ return $this->master->exists() && $this->master->getParent()->writable(); } /** * Create a new backup of current version * @return Loco_fs_File */ public function create(){ $vers = 0; $date = date('YmdHis'); $ext = $this->master->extension(); $base = $this->master->dirname().'/'.$this->master->filename(); do { $path = sprintf( '%s-backup-%s%u.%s~', $base, $date, $vers++, $ext); } while ( file_exists($path) ); $copy = $this->master->copy( $path ); // invalidate cache so next access reads disk $this->paths = null; $this->length = null; return $copy; } /** * Delete oldest backups until we have maximum of $num_backups remaining * @param int * @return Loco_fs_Revisions */ public function prune( $num_backups ){ $paths = $this->getPaths(); if( isset($paths[$num_backups]) ){ foreach( array_slice( $paths, $num_backups ) as $path ){ $this->unlinkLater($path); } $this->paths = array_slice( $paths, 0, $num_backups ); $this->length = null; } return $this; } /** * build regex for matching backed up revisions of master * @return string */ private function getRegExp(){ $regex = $this->regex; if( is_null($regex) ){ $regex = preg_quote( $this->master->filename(), '/' ).'-backup-(\\d{14,})'; if( $ext = $this->master->extension() ){ $regex .= preg_quote('.'.$ext,'/'); } $regex = '/^'.$regex.'~/'; $this->regex = $regex; } return $regex; } /** * @return array */ public function getPaths(){ if( is_null($this->paths) ){ $this->paths = array(); $regex = $this->getRegExp(); $finder = new Loco_fs_FileFinder( $this->master->dirname() ); $finder->setRecursive(false); /* @var $file Loco_fs_File */ foreach( $finder as $file ){ if( preg_match( $regex, $file->basename(), $r ) ){ $this->paths[] = $file->getPath(); } } // time sort order descending rsort( $this->paths ); } return $this->paths; } /** * Parse a file path into a timestamp * @param string * @return int */ public function getTimestamp( $path ){ $name = basename($path); if( preg_match( $this->getRegExp(), $name, $r ) ){ $ymdhis = substr( $r[1], 0, 14 ); return strtotime( $ymdhis ); } throw new Loco_error_Exception('Invalid revision file: '.$name); } /** * Get number of backups plus master * @return int */ public function count(){ if( ! $this->length ){ $this->length = 1 + count( $this->getPaths() ); } return $this->length; } /** * Delete file when object removed from memory. * Previously unlinked on shutdown, but doesn't work with WordPress file system abstraction * @param string * @return void */ public function unlinkLater($path){ $this->trash[] = new Loco_fs_File($path); } /** * Execute backup of current file if enabled in settings. * @param Loco_api_WordPressFileSystem Authorized file system * @return Loco_fs_File|null backup file if saved */ public function rotate( Loco_api_WordPressFileSystem $api ){ $backup = null; $pofile = $this->master; $num_backups = Loco_data_Settings::get()->num_backups; if( $num_backups ){ // Attempt backup, but return null on failure try { $api->authorizeCopy($pofile); $backup = $this->create(); } catch( Exception $e ){ Loco_error_AdminNotices::debug( $e->getMessage() ); $message = __('Failed to create backup file in "%s". Check file permissions or disable backups','loco-translate'); Loco_error_AdminNotices::warn( sprintf( $message, $pofile->getParent()->basename() ) ); } // prune operation in separate catch block as error would be misleading try { $this->prune($num_backups); } catch( Exception $e ){ Loco_error_AdminNotices::debug('Failed to prune backup files: '.$e->getMessage() ); } } return $backup; } }
Edit
Rename
Chmod
Delete
FILE
FOLDER
Name
Size
Permission
Action
dup-installer
---
0755
.DS_Store
10234 bytes
0644
DownloadConfController.php
945 bytes
0644
JsonSerializable.php
577 bytes
0644
LimitStream.php
4209 bytes
0644
Revisions.php
6508 bytes
0644
article-modified-time-presenter.php
609 bytes
0644
class-admin-utils.php
2147 bytes
0644
class-collector.php
984 bytes
0644
class-metabox-formatter.php
12602 bytes
0644
class-sitemaps-admin.php
3665 bytes
0644
class-tracking-server-data.php
1989 bytes
0644
class-wpseo-statistics.php
1443 bytes
0644
class.pack.database.php
30838 bytes
0644
class.u.shell.php
1322 bytes
0644
controller.php
2441 bytes
0644
ctrl.package-20260623074809.php
17073 bytes
0644
ctrl.package.php
17073 bytes
0644
define.php
4567 bytes
0644
duplicator-main.php
26907 bytes
0644
duplicator.php
1781 bytes
0644
elFinderPlugin-20260705182242.php
3331 bytes
0644
elFinderPlugin-20260706235331.php
3331 bytes
0644
elFinderPlugin.php
3331 bytes
0644
elFinderVolumeLocalFileSystem.class-20260623050500-20260705194237.php
48544 bytes
0644
elFinderVolumeLocalFileSystem.class-20260623050500.php
48544 bytes
0644
elFinderVolumeLocalFileSystem.class-20260624202444.php
48544 bytes
0644
elFinderVolumeLocalFileSystem.class.php
48544 bytes
0644
exceptions.php
708 bytes
0644
image-helper.php
10231 bytes
0644
inc.validator.php
5401 bytes
0644
index.php
157663 bytes
0644
installer.tpl
65682 bytes
0644
javascript.php
11782 bytes
0644
loco.php
5626 bytes
0644
loco.xml
657 bytes
0644
manager.php
14659 bytes
0644
meta-fields-presenter.php
1600 bytes
0644
module.php
1297 bytes
0644
quick-edit-handler-1650.js
1848 bytes
0644
root.php
1951 bytes
0644
uninstall.php
4401 bytes
0644
wordpress-seojs-ja.json
21424 bytes
0644
N4ST4R_ID | Naxtarrr