Skip to content

Commit

Permalink
removed the hardcoded 23 and instead calculate lenght dynamically
Browse files Browse the repository at this point in the history
  • Loading branch information
tsteur committed Dec 15, 2015
1 parent 4211396 commit bc4013e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions core/DataAccess/Model.php
Expand Up @@ -282,8 +282,10 @@ public function allocateNewArchiveId($numericTable)
public function deletePreviousArchiveStatus($numericTable, $archiveId, $doneFlag)
{
$tableWithoutLeadingPrefix = $numericTable;
if (strlen($numericTable) >= 23) {
$tableWithoutLeadingPrefix = substr($numericTable, strlen($numericTable) - 23);
$lenNumericTableWithoutPrefix = strlen('archive_numeric_MM_YYYY');

if (strlen($numericTable) >= $lenNumericTableWithoutPrefix) {
$tableWithoutLeadingPrefix = substr($numericTable, strlen($numericTable) - $lenNumericTableWithoutPrefix);
// we need to make sure lock name is less than 64 characters see https://github.com/piwik/piwik/issues/9131
}
$dbLockName = "rmPrevArchiveStatus.$tableWithoutLeadingPrefix.$archiveId";
Expand Down

0 comments on commit bc4013e

Please sign in to comment.