Page 1 of 1

Totally remove locks (checked_out)

Posted: 24 Oct 2016, 09:24
by gulp
Hello,
is it possible to disable locks on phocadownload ?
User never get skilled enough to always remember to save/close their items and other users are always waiting for those item to get unlocked.
I've seen some Joomla extension that clean the "locks" of many joomla sections but not in phocadownload.
What could be the solution to avoid this problem (I know, it is a user mistake, but ...)

Re: Totally remove locks (checked_out)

Posted: 27 Oct 2016, 00:00
by Jan
Hi, all this is managed by Joomla! so if there exists some extension for this, I think, such needs to be customized and extended to the Phoca Download tables (if possible) :idea: Unfortunately, this is not managed by Phoca Download and there is no part to customize it in Phoca Download :-(

Jan

Re: Totally remove locks (checked_out)

Posted: 27 Oct 2016, 08:52
by gulp
Hello !!
I've found the "autocheckin" extension that works good:
https://extensions.joomla.org/extension ... utocheckin
It needs to be updated to work also with phocadownload, but it is very simple.
Just add two block of code to support phocadownload files and categories to the plugin file
(/plugins/system/autocheckin/autocheckin.php)

Code: Select all

      $query = 'SELECT id,checked_out,checked_out_time FROM #__phocadownload WHERE checked_out > 0';
      $db->setQuery($query);
      $erg = $db->loadObjectList();
      $anz = count($erg);      
      for($x=0;$x < $anz;++$x) {
        $unter = strtotime($zeit) - strtotime($erg[$x]->checked_out_time);
        if ($unter >= $maxsec) {	
      	 $query = 'UPDATE #__phocadownload SET checked_out = 0 WHERE id = ' . $erg[$x]->id;
      	 $db->setQuery($query);
          $erg1 = $db->query(); 
        }
      }	

      $query = 'SELECT id,checked_out,checked_out_time FROM #__phocadownload_categories WHERE checked_out > 0';
      $db->setQuery($query);
      $erg = $db->loadObjectList();
      $anz = count($erg);      
      for($x=0;$x < $anz;++$x) {
        $unter = strtotime($zeit) - strtotime($erg[$x]->checked_out_time);
        if ($unter >= $maxsec) {	
      	 $query = 'UPDATE #__phocadownload_categories SET checked_out = 0 WHERE id = ' . $erg[$x]->id;
      	 $db->setQuery($query);
          $erg1 = $db->query(); 
        }
      }	
I hope it helps !!

Re: Totally remove locks (checked_out)

Posted: 28 Oct 2016, 18:18
by Jan
Ok, thank you for this info.

Jan