Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-12815

small bugn in ezdbfile::processCache

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Obsolete
    • Icon: Medium Medium
    • None
    • 3.10.0, 4.0.0
    • Legacy > Clustering
    • None

    Description

      In the processCache() function of eZDBFileHandler, there are some lines that look like:

                          if ( $this->metaData === false )
                              $this->loadMetaData();
                          if ( $this->metaData['mtime'] < 0 )
                          {
                              if ( $generateCallback !== false )
                                  eZDebugSetting::writeDebug( 'kernel-clustering', "Database file is deleted, need to regenerate data" );
                              else
                                  eZDebugSetting::writeDebug( 'kernel-clustering', "Database file is deleted, cannot get data" );
                              break;
                          }
      
                          if ( $this->metaData === false || eZDBFileHandler::isExpired( $fname, $mtime, $this->metaData['mtime'], $curtime, $ttl ) )
      //                      if ( $this->metaData === false || eZDBFileHandler::isExpired( $fname, $mtime, $expiry, $curtime, $ttl ) )
                          {
                              eZDebugSetting::writeDebug( 'kernel-clustering', "Local file (mtime=$mtime) is older than DB, check with DB" );
                              $forceDB = true;
                          }
      

      but the test for metadata === false imho should be pushed to the first test case: since we just reloaded metadata, the only case where it is false is if the file is not in the db (it has been purged). This is very similar to the having been deleted, rather than the db version being younger than the local copy.
      Correct version:

                          if ( $this->metaData === false )
                              $this->loadMetaData();
                          if ( $this->metaData === false || $this->metaData['mtime'] < 0 )
                          {
                              if ( $generateCallback !== false )
                                  eZDebugSetting::writeDebug( 'kernel-clustering', "Database file is deleted, need to regenerate data" );
                              else
                                  eZDebugSetting::writeDebug( 'kernel-clustering', "Database file is deleted, cannot get data" );
                              break;
                          }
      
                          if ( eZDBFileHandler::isExpired( $fname, $mtime, $this->metaData['mtime'], $curtime, $ttl ) )
      //                      if ( $this->metaData === false || eZDBFileHandler::isExpired( $fname, $mtime, $expiry, $curtime, $ttl ) )
                          {
                              eZDebugSetting::writeDebug( 'kernel-clustering', "Local file (mtime=$mtime) is older than DB, check with DB" );
                              $forceDB = true;
                          }
      

      Attachments

        Activity

          People

            unknown unknown
            72f8acac-185f-4a54-9470-a7473f50daab@accounts.ibexa.co Gaetano Giunta
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: