Skip to content

Commit d88eb9e

Browse files
authored
[5.2] Fix increment on non-alphanumeric string deprecation (joomla#44173)
1 parent edc24bb commit d88eb9e

File tree

5 files changed

+8
-11
lines changed

5 files changed

+8
-11
lines changed

administrator/components/com_banners/src/Model/BannerModel.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,7 @@ protected function prepareTable($table)
347347
// Set the values
348348
$table->created = $date->toSql();
349349
$table->created_by = $user->id;
350+
$table->version = 1;
350351

351352
// Set ordering to the last item if not set
352353
if (empty($table->ordering)) {
@@ -364,10 +365,8 @@ protected function prepareTable($table)
364365
// Set the values
365366
$table->modified = $date->toSql();
366367
$table->modified_by = $user->id;
368+
$table->version++;
367369
}
368-
369-
// Increment the content version number.
370-
$table->version++;
371370
}
372371

373372
/**

administrator/components/com_contact/src/Model/ContactModel.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,7 @@ protected function prepareTable($table)
363363
if (empty($table->id)) {
364364
// Set the values
365365
$table->created = $date;
366+
$table->version = 1;
366367

367368
// Set ordering to the last item if not set
368369
if (empty($table->ordering)) {
@@ -379,10 +380,8 @@ protected function prepareTable($table)
379380
// Set the values
380381
$table->modified = $date;
381382
$table->modified_by = $this->getCurrentUser()->id;
383+
$table->version++;
382384
}
383-
384-
// Increment the content version number.
385-
$table->version++;
386385
}
387386

388387
/**

administrator/components/com_content/src/Model/ArticleModel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ protected function prepareTable($table)
347347
}
348348

349349
// Increment the content version number.
350-
$table->version++;
350+
$table->version = empty($table->version) ? 1 : $table->version + 1;
351351

352352
// Reorder the articles within the category so the new article is first
353353
if (empty($table->id)) {

administrator/components/com_newsfeeds/src/Model/NewsfeedModel.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,7 @@ protected function prepareTable($table)
305305
if (empty($table->id)) {
306306
// Set the values
307307
$table->created = $date->toSql();
308+
$table->version = 1;
308309

309310
// Set ordering to the last item if not set
310311
if (empty($table->ordering)) {
@@ -321,10 +322,8 @@ protected function prepareTable($table)
321322
// Set the values
322323
$table->modified = $date->toSql();
323324
$table->modified_by = $user->id;
325+
$table->version++;
324326
}
325-
326-
// Increment the content version number.
327-
$table->version++;
328327
}
329328

330329
/**

administrator/components/com_tags/src/Model/TagModel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ public function save($data)
325325
protected function prepareTable($table)
326326
{
327327
// Increment the content version number.
328-
$table->version++;
328+
$table->version = empty($table->version) ? 1 : $table->version + 1;
329329
}
330330

331331
/**

0 commit comments

Comments
 (0)