Totally remove locks (checked_out)

Phoca Download - download manager
gulp
Phoca Member
Phoca Member
Posts: 33
Joined: 09 Oct 2012, 12:45

Totally remove locks (checked_out)

Post 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 ...)

Tags:
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48386
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Totally remove locks (checked_out)

Post 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
If you find Phoca extensions useful, please support the project
gulp
Phoca Member
Phoca Member
Posts: 33
Joined: 09 Oct 2012, 12:45

Re: Totally remove locks (checked_out)

Post 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 !!
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48386
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Totally remove locks (checked_out)

Post by Jan »

Ok, thank you for this info.

Jan
If you find Phoca extensions useful, please support the project
Post Reply