mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-30 21:40:43 +02:00
[ticket/14925] Set reparser names in service definitions
PHPBB3-14925
This commit is contained in:
@@ -15,6 +15,11 @@ namespace phpbb\textreparser;
|
||||
|
||||
abstract class base implements reparser_interface
|
||||
{
|
||||
/**
|
||||
* @var string The reparser name
|
||||
*/
|
||||
protected $name;
|
||||
|
||||
/**
|
||||
* @var bool Whether to save changes to the database
|
||||
*/
|
||||
@@ -89,6 +94,26 @@ abstract class base implements reparser_interface
|
||||
return $record;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the name of the reparser
|
||||
*
|
||||
* @return string Name of reparser
|
||||
*/
|
||||
public function get_name()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the name of the reparser
|
||||
*
|
||||
* @param string $name The reparser name
|
||||
*/
|
||||
public function set_name($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable saving changes to the database
|
||||
*/
|
||||
@@ -231,7 +256,7 @@ abstract class base implements reparser_interface
|
||||
$unparsed['enable_flash_bbcode'],
|
||||
$unparsed['enable_quote_bbcode'],
|
||||
$unparsed['enable_url_bbcode'],
|
||||
'reparse'
|
||||
$this->get_name()
|
||||
);
|
||||
|
||||
// Save the new text if it has changed and it's not a dry run
|
||||
|
@@ -125,4 +125,24 @@ class manager
|
||||
$this->schedule($reparser, $interval);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds a reparser by name.
|
||||
*
|
||||
* If there is no reparser with the specified name, null is returned.
|
||||
*
|
||||
* @param string $name Name of the reparser to look up.
|
||||
* @return string A reparser service name, or null.
|
||||
*/
|
||||
public function find_reparser($name)
|
||||
{
|
||||
foreach ($this->reparsers as $service => $reparser)
|
||||
{
|
||||
if ($reparser->get_name() == $name)
|
||||
{
|
||||
return $service;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@@ -22,6 +22,20 @@ interface reparser_interface
|
||||
*/
|
||||
public function get_max_id();
|
||||
|
||||
/**
|
||||
* Returns the name of the reparser
|
||||
*
|
||||
* @return string Name of reparser
|
||||
*/
|
||||
public function get_name();
|
||||
|
||||
/**
|
||||
* Sets the name of the reparser
|
||||
*
|
||||
* @param string $name The reparser name
|
||||
*/
|
||||
public function set_name($name);
|
||||
|
||||
/**
|
||||
* Reparse all records in given range
|
||||
*
|
||||
|
Reference in New Issue
Block a user