public function execute() { $this->dryrun = !$this->hasOption('really'); if ($this->dryrun) { $this->output("DRY-RUN mode: actions are NOT executed\n"); } else { $this->output("EXECUTE mode: actions ARE executed\n"); } $db = ContentTranslation\Database::getConnection(DB_MASTER); $translations = $this->getRelevantTranslations($db); foreach ($translations as $row) { $name = sprintf("%-35s\t[%s]\t->\t%-35s\t[%s]\t", $row->translation_source_title, $row->translation_source_language, $row->translation_target_title, $row->translation_target_language); $this->output("{$name} ({$row->translation_status})\n"); $this->checkTargetUrl($row); } $count = count($this->resets); if (!$count) { $this->output("No changes to do\n"); return; } if ($this->dryrun) { $this->output("{$count} rows would be updated to set target_url to null\n"); } else { $this->output("{$count} rows ARE updated to set target_url to null\n"); $db->update('cx_translations', array('translation_target_url' => null), array('translation_id' => $this->resets), __METHOD__); } }
public function execute() { $this->dryrun = !$this->hasOption('really'); if ($this->dryrun) { $this->output("DRY-RUN mode: actions are NOT executed\n"); } else { $this->output("EXECUTE mode: actions ARE executed\n"); } $db = ContentTranslation\Database::getConnection(DB_MASTER); $translations = $this->getRelevantTranslations($db); foreach ($translations as $row) { $name = sprintf("%-35s\t[%s]\t->\t%-35s\t[%s]\t", $row->translation_source_title, $row->translation_source_language, $row->translation_target_title, $row->translation_target_language); $this->output("{$name} ({$row->translation_status})\n"); $this->checkTargetUrl($row); } $this->changeStatus($this->resets, $this->dryrun); $this->addTags($this->tags, $this->dryrun); }