* @since 0.1 */ class MoveController extends Controller { /** * переносим данные с диска в s3 * @return int Exit code */ public function actionIndex() { $flag = true; $limit = 100; $offset = 0; while ($flag) { $models = File::find()->limit($limit)->offset($offset)->all(); foreach ($models as $model) { $model->moveToS3(false); } $flag = count($models) == $limit; $offset += $limit; echo "перенесено: {$offset} \n"; } return ExitCode::OK; } }