* @license GNU General Public License, version 2 (GPL-2.0)
*
* For full copyright and license information, please see
* the docs/CREDITS.txt file.
*
*/
namespace phpbb\console\command\cron;
use phpbb\exception\runtime_exception;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Output\OutputInterface;
class run extends \phpbb\console\command\command
{
/** @var \phpbb\cron\manager */
protected $cron_manager;
/** @var \phpbb\lock\db */
protected $lock_db;
/**
* Construct method
*
* @param \phpbb\user $user The user object (used to get language information)
* @param \phpbb\cron\manager $cron_manager The cron manager containing
* the cron tasks to be executed.
* @param \phpbb\lock\db $lock_db The lock for accessing database.
*/
public function __construct(\phpbb\user $user, \phpbb\cron\manager $cron_manager, \phpbb\lock\db $lock_db)
{
$this->cron_manager = $cron_manager;
$this->lock_db = $lock_db;
parent::__construct($user);
}
/**
* Sets the command name and description
*
* @return null
*/
protected function configure()
{
$this
->setName('cron:run')
->setDescription($this->user->lang('CLI_DESCRIPTION_CRON_RUN'))
->setHelp($this->user->lang('CLI_HELP_CRON_RUN'))
->addArgument('name', InputArgument::OPTIONAL, $this->user->lang('CLI_DESCRIPTION_CRON_RUN_ARGUMENT_1'))
;
}
/**
* Executes the command cron:run.
*
* Tries to acquire the cron lock, then if no argument has been given runs all ready cron tasks.
* If the cron lock can not be obtained, an error message is printed
* and the exit status is set to 1.
* If the verbose option is specified, each start of a task is printed.
* Otherwise there is no output.
* If an argument is given to the command, only the task whose name matches the
* argument will be started. If verbose option is specified,
* an info message containing the name of the task is printed.
* If no task matches the argument given, an error message is printed
* and the exit status is set to 2.
*
* @param InputInterface $input The input stream used to get the argument and verboe option.
* @param OutputInterface $output The output stream, used for printing verbose-mode and error information.
*
* @return int 0 if all is ok, 1 if a lock error occured and 2 if no task matching the argument was found.
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
if ($this->lock_db->acquire())
{
$task_name = $input->getArgument('name');
if ($task_name)
{
$exit_status = $this->run_one($input, $output, $task_name);
}
else
{
$exit_status = $this->run_all($input, $output);
}
$this->lock_db->release();
return $exit_status;
}
else
{
throw new runtime_exception('CRON_LOCK_ERROR', array(), null, 1);
}
}
/**
* Executes all ready cron tasks.
*
* If verbose mode is set, an info message will be printed if there is no task to
* be run, or else for each starting task.
*
* @see execute
* @param InputInterface $input The input stream used to get the argument and verbose option.
* @param OutputInterface $output The output stream, used for printing verbose-mode and error information.
* @return int 0
*/
protected function run_all(InputInterface $input, OutputInterface $output)
{
$run_tasks = $this->cron_manager->find_all_ready_tasks();
if ($run_tasks)
{
foreach ($run_tasks as $task)
{
if ($input->getOption('verbose'))
{
$output->writeln('
# translation of DrakX.po to Punjabi
# translation of DrakX.po to Panjabi
# Copyright (C) 2005 Free Software Foundation, Inc.
# Kanwaljeet Singh Brar <kanwaljeetbrar@yahoo.co.in>, 2005.
# Jaswinder Singh Phulewala <jaswinderphulewala@yahoo.com>, 2005.
#
msgid ""
msgstr ""
"Project-Id-Version: DrakX\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-08-04 18:39+EEST\n"
"PO-Revision-Date: 2005-03-27 17:55+0530\n"
"Last-Translator: Jaswinder Singh Phulewala <jaswinderphulewala@yahoo.com>\n"
"Language-Team: Punjabi <punlinux-i18n@lists.soruceforge.net>\n"
"Language: pa\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: KBabel 1.9.1\n"
#: ../src/msec/config.py:46
msgid "Modified system files"
msgstr ""
#: ../src/msec/config.py:47
#, fuzzy
msgid "No changes in system files"
msgstr "ਨਾ-ਮਲਕੀਅਤ ਫਾਇਲਾਂ ਦੀ ਰਿਪੋਰਟ ਕਰੋ"
#: ../src/msec/config.py:60 ../src/msec/tools.py:36
msgid "Disabled"
msgstr ""
#: ../src/msec/config.py:211 ../src/msec/config.py:423
msgid "Unable to load configuration file %s: %s"
msgstr ""
#: ../src/msec/config.py:225 ../src/msec/config.py:334
#: ../src/msec/config.py:442
#, fuzzy
msgid "Bad config option: %s"
msgstr "ਸਾਊਂਡ ਸੰਰਚਨਾ"
#: ../src/msec/config.py:260 ../src/msec/config.py:373
#: ../src/msec/config.py:468
msgid "Unable to save %s: %s"
msgstr ""
#: ../src/msec/config.py:319
msgid "loading exceptions file %s: %s"
msgstr ""
#: ../src/msec/config.py:320
#, fuzzy
msgid "No exceptions loaded"
msgstr "ਚੋਣ"
#: ../src/msec/help.py:14
#, fuzzy
msgid ""
"Allow local users to connect to X server. Accepted arguments: yes (all "
"connections are allowed), local (only local connection), no (no connection)."
msgstr ""
"ਇਜਾਜ਼ਤ/ਮਨਾਹੀ X ਕੁਨੈਕਸ਼ਨ:\n"
"\n"
"- ਸਭ (ਸਭ ਕੁਨੈਕਸ਼ਨਾਂ ਨੂੰ ਇਜਾਜ਼ਤ ਹੈ),\n"
"\n"
"- ਲੋਕਲ (ਸਿਰਫ ਲੋਕਲ ਮਸ਼ੀਨਾਂ ਤੋਂ ਕੁਨੈਕਸ਼ਨ ਦੀ ਇਜਾਜ਼ਤ ਹੈ),\n"
"\n"
"- ਕੋਈ ਨਹੀਂ (ਕੋਈ ਕੁਨੈਕਸ਼ਨ ਨਹੀਂ)।"
#: ../src/msec/help.py:16
#, fuzzy
msgid "Enable checking for files/directories writable by everybody."
msgstr "ਹਰੇਕ ਦੁਆਰਾ ਲਿਖਣ ਯੋਗ ਫਾਇਲਾਂ/ਡਾਇਰੈਕਟਰੀਆਂ ਦੀ ਜਾਂਚ ਕਰੋ"
#: ../src/msec/help.py:18
#, fuzzy
msgid "Enable checking for empty passwords in /etc/shadow (man shadow(5))."
msgstr "/etc/shadow ਵਿੱਚ ਖਾਲੀ ਗੁਪਤ-ਕੋਡ ਦੀ ਜਾਂਚ ਕਰੋ"
#: ../src/msec/help.py:20
msgid "Log syslog messages on console terminal 12."
msgstr ""
#: ../src/msec/help.py:22
msgid "Send mail reports even if no changes were detected."
msgstr ""
#: ../src/msec/help.py:24
msgid ""
"Defines the base security level, on top of which the current configuration "
"is based."
msgstr ""
#: ../src/msec/help.py:26
#, fuzzy
msgid "Accept broadcasted ICMP echo."
msgstr "ਬਰਾਡਕਾਸਟ icmp echo ਪ੍ਰਾਪਤ ਕਰੋ"
#: ../src/msec/help.py:28
msgid ""
"Enable verification for changes in the installed RPM packages. This will "
"notify you when new packages are installed or removed."
msgstr ""
#: ../src/msec/help.py:30
msgid "Enable periodic permission checking for files specified in msec policy."
msgstr ""
#: ../src/msec/help.py:32
msgid "Ignore changes in process IDs when checking for open network ports."
msgstr ""
#: ../src/msec/help.py:34
msgid "Allow X server to accept connections from network on tcp port 6000."
msgstr ""
#: ../src/msec/help.py:36
msgid "Enable checking for known rootkits using chkrootkit."
msgstr ""
#: ../src/msec/help.py:38
msgid ""
"Enable msec to enforce file permissions to the values specified in the msec "
"security policy."
msgstr ""
#: ../src/msec/help.py:40
msgid ""
"Enable sectools checks. This check will run all sectool checks for a "
"security level configuration. The security level to be used during this test "
"is determined by the CHECK_SECTOOL_LEVELS variable."
msgstr ""
#: ../src/msec/help.py:42
msgid "Set shell commands history size. A value of -1 means unlimited."
msgstr "ਸ਼ੈੱਲ ਕਮਾਂਡ ਅਤੀਤ ਅਕਾਰ ਨਿਰਧਾਰਿਤ ਕਰੋ। ਮੁੱਲ -1 ਦਾ ਮਤਲਬ ਹੈ ਬੇਅੰਤ।"
#: ../src/msec/help.py:44
#, fuzzy
msgid "Allow system reboot and shutdown to local users."
msgstr "ਕੰਸੋਲ ਉਪਭੋਗੀ ਦੁਆਰਾ ਮੁੜ-ਚਲਾਓ ਇਜਾਜ਼ਤ/ ਮਨਾਹੀ।"
#: ../src/msec/help.py:46
#, fuzzy
msgid "Enable checking for changes in firewall settings."
msgstr "ਨਾ-ਮਲਕੀਅਤ ਫਾਇਲਾਂ ਦੀ ਰਿਪੋਰਟ ਕਰੋ"
#: ../src/msec/help.py:48
#, fuzzy
msgid "Enable checking for additions/removals of suid root files."
msgstr "suid ਰੂਟ ਫਾਇਲਾਂ ਦੀ ਸ਼ਾਮਲੀਅਤ/ਹਟਾਉਣ ਦੀ ਜਾਂਚ ਕਰੋ"
#: ../src/msec/help.py:50
msgid "Include current directory into user PATH by default"
msgstr ""
#: ../src/msec/help.py:52
#, fuzzy
msgid ""
"Enable crontab and at for users. Put allowed users in /etc/cron.allow and /"
"etc/at.allow (see man at(1) and crontab(1))."
msgstr ""
"ਯੋਗ/ਅਯੋਗ crontab ਅਤੇ ਉਪਭੋਗੀ ਲਈ।\n"
"\n"