Joomla CMS  3.8.5 (avec JPlatform 13.1 inclus)
Documentation des API du CMS Joomla en version 3.8.5 et du framework Joomla Platform intégré
Référence de la classe JFilesystemPatcher

Fonctions membres publiques

 reset ()
 
 apply ()
 
 addFile ($filename, $root=JPATH_BASE, $strip=0)
 
 add ($udiff, $root=JPATH_BASE, $strip=0)
 

Fonctions membres publiques statiques

static getInstance ()
 

Champs de données

const SRC_FILE = '/^---\\s+(\\S+)\s+\\d{1,4}-\\d{1,2}-\\d{1,2}\\s+\\d{1,2}:\\d{1,2}:\\d{1,2}(\\.\\d+)?\\s+(\+|-)\\d{4}/A'
 
const DST_FILE = '/^\\+\\+\\+\\s+(\\S+)\s+\\d{1,4}-\\d{1,2}-\\d{1,2}\\s+\\d{1,2}:\\d{1,2}:\\d{1,2}(\\.\\d+)?\\s+(\+|-)\\d{4}/A'
 
const HUNK = '/@@ -(\\d+)(,(\\d+))?\\s+\\+(\\d+)(,(\\d+))?\\s+@@($)/A'
 
const SPLIT = '/(\r\n)|(\r)|(\n)/'
 

Fonctions membres protégées

 __construct ()
 
 applyHunk (&$lines, $src, $dst, $src_line, $src_size, $dst_line, $dst_size)
 
getSource ($src)
 
getDestination ($dst, $src)
 

Fonctions membres protégées statiques

static splitLines ($data)
 
static findHeader (&$lines, &$src, &$dst)
 
static findHunk (&$lines, &$src_line, &$src_size, &$dst_line, &$dst_size)
 

Attributs protégés

 $sources = array()
 
 $destinations = array()
 
 $removals = array()
 
 $patches = array()
 

Attributs protégés statiques

static $instance
 

Description détaillée

Documentation des constructeurs et destructeur

◆ __construct()

__construct ( )
protected

Constructor

The constructor is protected to force the use of JFilesystemPatcher::getInstance()

Depuis
12.1

Documentation des fonctions membres

◆ add()

add (   $udiff,
  $root = JPATH_BASE,
  $strip = 0 
)

Add a unified diff string to the patcher

Paramètres
string$udiffUnified diff input string
string$rootThe files root path
string$stripThe number of '/' to strip
Renvoie
JFilesystemPatcher $this for chaining
Depuis
12.1

Références $root, et DIRECTORY_SEPARATOR.

◆ addFile()

addFile (   $filename,
  $root = JPATH_BASE,
  $strip = 0 
)

Add a unified diff file to the patcher

Paramètres
string$filenamePath to the unified diff file
string$rootThe files root path
string$stripThe number of '/' to strip
Renvoie
JFilesystemPatcher $this for chaining
Depuis
12.1

Références $root.

◆ apply()

apply ( )

Apply the patches

Renvoie
integer The number of files patched
Depuis
12.1
Exceptions
RuntimeException

Références $buffer, $content, $file, JFile\delete(), null, et JFile\write().

◆ applyHunk()

applyHunk ( $lines,
  $src,
  $dst,
  $src_line,
  $src_size,
  $dst_line,
  $dst_size 
)
protected

Apply the patch

Paramètres
array&$linesThe udiff array of lines
string$srcThe source file
string$dstThe destination file
string$src_lineThe beginning of the patch for the source file
string$src_sizeThe size of the patch for the source file
string$dst_lineThe beginning of the patch for the destination file
string$dst_sizeThe size of the patch for the destination file
Renvoie
void
Depuis
12.1
Exceptions
RuntimeException

Références elseif.

◆ findHeader()

static findHeader ( $lines,
$src,
$dst 
)
staticprotected

Find the diff header

The internal array pointer of $lines is on the next line after the finding

Paramètres
array&$linesThe udiff array of lines
string&$srcThe source file
string&$dstThe destination file
Renvoie
boolean TRUE in case of success, FALSE in case of failure
Depuis
12.1
Exceptions
RuntimeException

◆ findHunk()

static findHunk ( $lines,
$src_line,
$src_size,
$dst_line,
$dst_size 
)
staticprotected

Find the next hunk of difference

The internal array pointer of $lines is on the next line after the finding

Paramètres
array&$linesThe udiff array of lines
string&$src_lineThe beginning of the patch for the source file
string&$src_sizeThe size of the patch for the source file
string&$dst_lineThe beginning of the patch for the destination file
string&$dst_sizeThe size of the patch for the destination file
Renvoie
boolean TRUE in case of success, false in case of failure
Depuis
12.1
Exceptions
RuntimeException

◆ getDestination()

& getDestination (   $dst,
  $src 
)
protected

Get the lines of a destination file

Paramètres
string$dstThe path of a destination file
string$srcThe path of a source file
Renvoie
array The lines of the destination file
Depuis
12.1

◆ getInstance()

static getInstance ( )
static

Method to get a patcher

Renvoie
JFilesystemPatcher an instance of the patcher
Depuis
12.1

◆ getSource()

& getSource (   $src)
protected

Get the lines of a source file

Paramètres
string$srcThe path of a file
Renvoie
array The lines of the source file
Depuis
12.1

Références null.

◆ reset()

reset ( )

Reset the pacher

Renvoie
JFilesystemPatcher This object for chaining
Depuis
12.1

◆ splitLines()

static splitLines (   $data)
staticprotected

Separate CR or CRLF lines

Paramètres
string$dataInput string
Renvoie
array The lines of the inputdestination file
Depuis
12.1

Références $data.

Documentation des champs

◆ $destinations

$destinations = array()
protected

◆ $instance

$instance
staticprotected

◆ $patches

$patches = array()
protected

◆ $removals

$removals = array()
protected

◆ $sources

$sources = array()
protected

◆ DST_FILE

const DST_FILE = '/^\\+\\+\\+\\s+(\\S+)\s+\\d{1,4}-\\d{1,2}-\\d{1,2}\\s+\\d{1,2}:\\d{1,2}:\\d{1,2}(\\.\\d+)?\\s+(\+|-)\\d{4}/A'

Regular expression for searching destination files

◆ HUNK

const HUNK = '/@@ -(\\d+)(,(\\d+))?\\s+\\+(\\d+)(,(\\d+))?\\s+@@($)/A'

Regular expression for searching hunks of differences

◆ SPLIT

const SPLIT = '/(\r\n)|(\r)|(\n)/'

Regular expression for splitting lines

◆ SRC_FILE

const SRC_FILE = '/^---\\s+(\\S+)\s+\\d{1,4}-\\d{1,2}-\\d{1,2}\\s+\\d{1,2}:\\d{1,2}:\\d{1,2}(\\.\\d+)?\\s+(\+|-)\\d{4}/A'

Regular expression for searching source files


La documentation de cette classe a été générée à partir du fichier suivant :