Skip to content

Instantly share code, notes, and snippets.

@wbarcovsky
Last active September 14, 2015 12:08
Show Gist options
  • Select an option

  • Save wbarcovsky/b050d60cb048a473fb2d to your computer and use it in GitHub Desktop.

Select an option

Save wbarcovsky/b050d60cb048a473fb2d to your computer and use it in GitHub Desktop.
public function actionAllTimeoutChange()
{
$companiesPath = Yii::app()->getBasePath() . '/companies/*';
$dirs = array_filter(glob($companiesPath), 'is_dir');
foreach ($dirs as $dir) {
$companyName = '';
if (preg_match('/([^\/]+)$/', $dir, $matches)) {
try {
$companyName = $matches[1];
echo "Company `$companyName`: mailing started\n";
$this->runCommand("password timeoutChange --company=$companyName");
echo "Company `$companyName`: mailing ended\n";
} catch (Exception $e) {
echo "Company `$companyName`: mailing failed\n";
echo $e->getMessage();
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment