Back to Joomla project (class list)

Class Patcher - list of methods

A Unified Diff Format Patcher class
Package: Joomla\CMS\Filesystem
Copyright: (C) 2012 Open Source Matters, Inc.
License: GNU General Public License version 2 or later; see LICENSE.txt
Located at: Joomla/Filesystem/Patcher.php
Project: Joomla

Method Summary

protected
()

Constructor
Since
  • 3.0.0
Show source code of this method: __construct Source Code

public static \Joomla\CMS\Filesystem\Patcher
()

Method to get a patcher
Returns
  • \Joomla\CMS\Filesystem\Patcher an instance of the patcher
Since
  • 3.0.0
Show source code of this method: getInstance Source Code

public \Joomla\CMS\Filesystem\Patcher
()

Reset the patcher
Returns
  • \Joomla\CMS\Filesystem\Patcher This object for chaining
Since
  • 3.0.0
Show source code of this method: reset Source Code

public int
()

Apply the patches
Returns
  • int The number of files patched
Since
  • 3.0.0
-
  • \RuntimeException
Show source code of this method: apply Source Code

public \Joomla\CMS\Filesystem\Patcher
(mixed $filename, mixed $root = JPATH_BASE, mixed $strip = 0)

Add a unified diff file to the patcher
Parameters
  • string $filename Path to the unified diff file
  • string $root The files root path
  • int $strip The number of '/' to strip
Returns
  • \Joomla\CMS\Filesystem\Patcher $this for chaining
Since
  • 3.0.0
Show source code of this method: addFile Source Code

public \Joomla\CMS\Filesystem\Patcher
(mixed $udiff, mixed $root = JPATH_BASE, mixed $strip = 0)

Add a unified diff string to the patcher
Parameters
  • string $udiff Unified diff input string
  • string $root The files root path
  • int $strip The number of '/' to strip
Returns
  • \Joomla\CMS\Filesystem\Patcher $this for chaining
Since
  • 3.0.0
Show source code of this method: add Source Code

protected static array
(mixed $data)

Separate CR or CRLF lines
Parameters
  • string $data Input string
Returns
  • array The lines of the inputdestination file
Since
  • 3.0.0
Show source code of this method: splitLines Source Code

protected static bool
(mixed &$lines, mixed &$src, mixed &$dst)

Find the diff header
Parameters
  • array $lines The udiff array of lines
  • string $src The source file
  • string $dst The destination file
Returns
  • bool TRUE in case of success, FALSE in case of failure
Since
  • 3.0.0
-
  • \RuntimeException
Show source code of this method: findHeader Source Code

protected static bool
(mixed &$lines, mixed &$srcLine, mixed &$srcSize, mixed &$dstLine, mixed &$dstSize)

Find the next hunk of difference
Parameters
  • array $lines The udiff array of lines
  • string $srcLine The beginning of the patch for the source file
  • string $srcSize The size of the patch for the source file
  • string $dstLine The beginning of the patch for the destination file
  • string $dstSize The size of the patch for the destination file
Returns
  • bool TRUE in case of success, false in case of failure
Since
  • 3.0.0
-
  • \RuntimeException
Show source code of this method: findHunk Source Code

protected void
(mixed &$lines, mixed $src, mixed $dst, mixed $srcLine, mixed $srcSize, mixed $dstLine, mixed $dstSize)

Apply the patch
Parameters
  • array $lines The udiff array of lines
  • string $src The source file
  • string $dst The destination file
  • string $srcLine The beginning of the patch for the source file
  • string $srcSize The size of the patch for the source file
  • string $dstLine The beginning of the patch for the destination file
  • string $dstSize The size of the patch for the destination file
Returns
  • void
Since
  • 3.0.0
-
  • \RuntimeException
Show source code of this method: applyHunk Source Code

protected array
(mixed $src)

Get the lines of a source file
Parameters
  • string $src The path of a file
Returns
  • array The lines of the source file
Since
  • 3.0.0
Show source code of this method: getSource Source Code

protected array
(mixed $dst, mixed $src)

Get the lines of a destination file
Parameters
  • string $dst The path of a destination file
  • string $src The path of a source file
Returns
  • array The lines of the destination file
Since
  • 3.0.0
Show source code of this method: getDestination Source Code

Properties Summary

protected array
$sources
Since
  • 3.0.0
protected array
$destinations
Since
  • 3.0.0
protected array
$removals
Since
  • 3.0.0
protected array
$patches
Since
  • 3.0.0
protected static array
$instance
Since
  • 3.0.0

Constants Summary

public
$SRC_FILE
Regular expression for searching source files
public
$DST_FILE
Regular expression for searching destination files
public
$HUNK
Regular expression for searching hunks of differences
public
$SPLIT
Regular expression for splitting lines

Tags Summary

Since
3.0.0