mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #4492 from spekulatius/tailing-space-in-task
remove tailing spaces in task
This commit is contained in:
commit
2346d4ad4c
@ -4,9 +4,9 @@
|
|||||||
* @subpackage tasks
|
* @subpackage tasks
|
||||||
*/
|
*/
|
||||||
class i18nTextCollectorTask extends BuildTask {
|
class i18nTextCollectorTask extends BuildTask {
|
||||||
|
|
||||||
protected $title = "i18n Textcollector Task";
|
protected $title = "i18n Textcollector Task";
|
||||||
|
|
||||||
protected $description = "
|
protected $description = "
|
||||||
Traverses through files in order to collect the 'entity master tables'
|
Traverses through files in order to collect the 'entity master tables'
|
||||||
stored in each module.
|
stored in each module.
|
||||||
@ -17,56 +17,56 @@ class i18nTextCollectorTask extends BuildTask {
|
|||||||
- module: One or more modules to limit collection (comma-separated)
|
- module: One or more modules to limit collection (comma-separated)
|
||||||
- merge: Merge new strings with existing ones already defined in language files (default: FALSE)
|
- merge: Merge new strings with existing ones already defined in language files (default: FALSE)
|
||||||
";
|
";
|
||||||
|
|
||||||
public function init() {
|
public function init() {
|
||||||
parent::init();
|
parent::init();
|
||||||
|
|
||||||
$canAccess = (Director::isDev() || Director::is_cli() || Permission::check("ADMIN"));
|
$canAccess = (Director::isDev() || Director::is_cli() || Permission::check("ADMIN"));
|
||||||
if(!$canAccess) {
|
if(!$canAccess) {
|
||||||
return Security::permissionFailure($this);
|
return Security::permissionFailure($this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the main method to build the master string tables with the original strings.
|
* This is the main method to build the master string tables with the original strings.
|
||||||
* It will search for existent modules that use the i18n feature, parse the _t() calls
|
* It will search for existent modules that use the i18n feature, parse the _t() calls
|
||||||
* and write the resultant files in the lang folder of each module.
|
* and write the resultant files in the lang folder of each module.
|
||||||
*
|
*
|
||||||
* @uses DataObject->collectI18nStatics()
|
* @uses DataObject->collectI18nStatics()
|
||||||
*
|
*
|
||||||
* @param SS_HTTPRequest $request
|
* @param SS_HTTPRequest $request
|
||||||
*/
|
*/
|
||||||
public function run($request) {
|
public function run($request) {
|
||||||
increase_time_limit_to();
|
increase_time_limit_to();
|
||||||
$collector = i18nTextCollector::create($request->getVar('locale'));
|
$collector = i18nTextCollector::create($request->getVar('locale'));
|
||||||
|
|
||||||
$merge = $this->getIsMerge($request);
|
$merge = $this->getIsMerge($request);
|
||||||
|
|
||||||
// Custom writer
|
// Custom writer
|
||||||
$writerName = $request->getVar('writer');
|
$writerName = $request->getVar('writer');
|
||||||
if($writerName) {
|
if($writerName) {
|
||||||
$writer = Injector::inst()->get($writerName);
|
$writer = Injector::inst()->get($writerName);
|
||||||
$collector->setWriter($writer);
|
$collector->setWriter($writer);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get restrictions
|
// Get restrictions
|
||||||
$restrictModules = ($request->getVar('module'))
|
$restrictModules = ($request->getVar('module'))
|
||||||
? explode(',', $request->getVar('module'))
|
? explode(',', $request->getVar('module'))
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
$collector->run($restrictModules, $merge);
|
$collector->run($restrictModules, $merge);
|
||||||
|
|
||||||
Debug::message(__CLASS__ . " completed!", false);
|
Debug::message(__CLASS__ . " completed!", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if we should merge
|
* Check if we should merge
|
||||||
*
|
*
|
||||||
* @param SS_HTTPRequest $request
|
* @param SS_HTTPRequest $request
|
||||||
*/
|
*/
|
||||||
protected function getIsMerge($request) {
|
protected function getIsMerge($request) {
|
||||||
$merge = $request->getVar('merge');
|
$merge = $request->getVar('merge');
|
||||||
|
|
||||||
// Default to false if not given
|
// Default to false if not given
|
||||||
if(!isset($merge)) {
|
if(!isset($merge)) {
|
||||||
Deprecation::notice(
|
Deprecation::notice(
|
||||||
|
Loading…
Reference in New Issue
Block a user