Limit upload plugin for cpg1.6.x Limit upload plugin for cpg1.6.x
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Limit upload plugin for cpg1.6.x

Started by Αndré, November 27, 2018, 04:59:25 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

Αndré

This is the cpg1.6.x and PHP7 compatible version of the Limit upload plugin.

Quote from: Αndré on July 06, 2010, 03:13:32 PM
This plugin allows you to limit the number of uploads for your users. You can choose a total number of files, or a certain amount of files for different periods of time.

lurkalot

Thank you Andre.  I uninstalled the old one, and went to install this new one, unfortunately it gives me this error when I try. 

Critical error

There was an error while processing a database query.


While executing query 'INSERT INTO cpg_config (name, value) VALUES ('limit_upload_upload_limit', '-1')' in plugins/limit_upload/codebase.php on line 96

database error: 1062 : Duplicate entry 'limit_upload_upload_limit' for key 'PRIMARY'

File: /hxxxx/cxxxxxxx/public_html/gallery/include/functions.inc.php - Line: 250 
Running SMF 2.1.4  / Tinyportal 3.0.1, bridged with Coppermine 1.6.25, plus cpmfetch 2.0.0

Αndré


lurkalot

Running SMF 2.1.4  / Tinyportal 3.0.1, bridged with Coppermine 1.6.25, plus cpmfetch 2.0.0

Αndré

There's nothing to fix in the plugin, as the config values will be deleted when uninstalling the plugin (that function existed since the very first version):
$thisplugin->add_action('plugin_uninstall', 'limit_upload_uninstall');

function limit_upload_uninstall () {
    global $CONFIG;
    cpg_db_query("DELETE FROM {$CONFIG['TABLE_CONFIG']} WHERE name = 'limit_upload_upload_limit'");
    cpg_db_query("DELETE FROM {$CONFIG['TABLE_CONFIG']} WHERE name = 'limit_upload_time_limit'");

    return true;
}


For whatever reason they haven't been deleted in your gallery (maybe missing permissions to use the DELETE command?). To get the plugin installed, either delete the rows "limit_upload_upload_limit" and "limit_upload_time_limit" from your config table with phpMyAdmin, or adjust those lines in codebase.php:
    cpg_db_query("INSERT INTO {$CONFIG['TABLE_CONFIG']} (name, value) VALUES ('limit_upload_upload_limit', '-1')");
    cpg_db_query("INSERT INTO {$CONFIG['TABLE_CONFIG']} (name, value) VALUES ('limit_upload_time_limit', 'total')");

(either commend them out or replace INSERT with REPLACE).

lurkalot

Thanks, I went with the delete table option, and now installed fine.  Not idea why it wouldn't delete those table when I uninstalled the old plugin though, I haven't had this problem with anything else I'm aware of.

One of those little mysteries I guess.  Anyway with your help it's sorted.  ;)
Running SMF 2.1.4  / Tinyportal 3.0.1, bridged with Coppermine 1.6.25, plus cpmfetch 2.0.0