Commit 98e5a1c5 authored by Shakarim Sapa's avatar Shakarim Sapa

- Обновляем записи

parent 1143603f
......@@ -74,6 +74,7 @@ class ReplaceController extends Controller
*/
public function actionBlocks()
{
/** @var CoBlocksLang[] $data */
$data = CoBlocksLang::find()->all();
$transaction = Yii::$app->db->beginTransaction();
try
......@@ -83,10 +84,10 @@ class ReplaceController extends Controller
if ($item->text!='')
{
// $item->text = str_replace('http://task-on.com/', 'https://task-on.com/', $item->text);
$item->text = str_replace('https://task-on.com/', '/', $item->text);
if (!$item->update())
$item->text = str_replace('http', 'https', $item->text);
if ($item->update()===false)
{
// throw new ServerErrorHttpException(current(current($item->getErrors())));
throw new ServerErrorHttpException(current(current($item->getErrors())));
}
echo "[".$item->getPrimaryKey()."] ".($i+1)." of ".count($data)." successfully updated\n";
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment