mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-24 02:13:15 +00:00
Merge pull request #2014 from jygaulier/PHRAS-1285_CLI-MAKESUBDEF-DELETES-SUBDEFS
fix: if using --name argument, some subdefs were deleted
This commit is contained in:
@@ -345,7 +345,9 @@ class BuildSubdefs extends Command
|
|||||||
|
|
||||||
while( ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) ) {
|
while( ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) ) {
|
||||||
$type = $row['type'];
|
$type = $row['type'];
|
||||||
$msg = sprintf(' record %s (%s) : ', $row['record_id'], $type);
|
$msg = [];
|
||||||
|
|
||||||
|
$msg[] = sprintf(' record %s (%s) :', $row['record_id'], $type);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$record = $this->databox->get_record($row['record_id']);
|
$record = $this->databox->get_record($row['record_id']);
|
||||||
@@ -366,7 +368,7 @@ class BuildSubdefs extends Command
|
|||||||
$subdef->delete();
|
$subdef->delete();
|
||||||
}
|
}
|
||||||
$subdefsDeleted[] = $name;
|
$subdefsDeleted[] = $name;
|
||||||
$msg .= sprintf(" \"%s\" deleted,", $name);
|
$msg[] = sprintf(" \"%s\" pruned", $name);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -386,10 +388,14 @@ class BuildSubdefs extends Command
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// here an existing subdef must be (re)done
|
// here an existing subdef must be (re)done
|
||||||
if(!$this->dry) {
|
if(isset($subdefNamesToDo[$name])) {
|
||||||
$subdef->remove_file();
|
if (!$this->dry) {
|
||||||
$subdef->set_substituted(false);
|
$subdef->remove_file();
|
||||||
|
$subdef->set_substituted(false);
|
||||||
|
}
|
||||||
|
$msg[] = sprintf(" [\"%s\"] deleted", $name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -401,7 +407,7 @@ class BuildSubdefs extends Command
|
|||||||
$subdefGenerator->generateSubdefs($record, $subdefNamesToDo);
|
$subdefGenerator->generateSubdefs($record, $subdefNamesToDo);
|
||||||
}
|
}
|
||||||
|
|
||||||
$msg .= sprintf(" [\"%s\"] built", implode('","', $subdefNamesToDo));
|
$msg[] = sprintf(" [\"%s\"] built", implode('","', $subdefNamesToDo));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// $msg .= " nothing to build";
|
// $msg .= " nothing to build";
|
||||||
@@ -416,10 +422,10 @@ class BuildSubdefs extends Command
|
|||||||
. ' WHERE record_id=:record_id';
|
. ' WHERE record_id=:record_id';
|
||||||
|
|
||||||
if($this->reset_subdef_flag) {
|
if($this->reset_subdef_flag) {
|
||||||
$msg .= ", jeton[\"make_subdef\"]=0";
|
$msg[] = "jeton[\"make_subdef\"]=0";
|
||||||
}
|
}
|
||||||
if($this->set_writemeta_flag) {
|
if($this->set_writemeta_flag) {
|
||||||
$msg .= ", jeton[\"write_met_subdef\"]=1";
|
$msg[] = "jeton[\"write_met_subdef\"]=1";
|
||||||
}
|
}
|
||||||
if(!$this->dry) {
|
if(!$this->dry) {
|
||||||
$this->connection->executeUpdate($sql, [
|
$this->connection->executeUpdate($sql, [
|
||||||
@@ -436,10 +442,10 @@ class BuildSubdefs extends Command
|
|||||||
|
|
||||||
if($progress) {
|
if($progress) {
|
||||||
$progress->advance();
|
$progress->advance();
|
||||||
$this->output->write($msg);
|
$this->output->write(implode(' ', $msg));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$this->output->writeln($msg);
|
$this->output->writeln(implode("\n", $msg));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user