~includeonce('../config.tmpl')
~includeonce('../config/spell.tmpl')
~includeonce('../lib/ressources.tmpl')
~includeonce('../lib/ressources_command.tmpl')
~includeonce('../lib/admin.tmpl')
~includeonce('../lib/tags.tmpl')
~includeonce('../lib/images.tmpl')
~mapfilenamevar('res_table')
~if(~integer(~get('res_table'))>0, {
~get_res_info(~get('res_table'),'res'),
~redirect('~get_site_url()admin/purge,~get('res[table]').html')
})
~set('res_type',~res_table_to_res_type(~get('res_table')))
~get_res_info(~get('res_type'),'res')
~set('res_name',~get('res[name]'))
~include('../site/admin.header.tmpl','Nettoyage ~get('res_name')')
~if( !~get('is_admin'), ~http_error(403))
~if(~get('res_name')=='tracker',
~redirect('~get_site_url()tracker/')
)
~if( ~file_exists('~getconf('templatedir')lib/~get('res_table').tmpl'),
~includeonce('../lib/~get('res_table').tmpl')
)
~img('img/svg/plus.svg','Ajouter','intxt') Ajouter ~spell_article('un', ~get('res[gender]'), ~get('res_name'))
~img('img/svg/admin-manage.svg','Gestion','intxt') Gestion des ~spell_plural(~get('res_name'))
~if( ~file_exists('~getconf('templatedir')admin/~get('res_table').menu'),
~include('~get('res_table').menu')
)
~mb_ucfirst(~spell_plural(~get('res_name'),~get('res[gender]'))) :
~list(~get('database'),
"SELECT count(*) AS count from ~get('res_table') WHERE state=~integer(~get('state_purged'))",'L1','~fld('count') ~spell_plural(~spell_gender(~get('res[gender]'),'purgé')), '
)
~list(~get('database'),
"SELECT count(*) AS count from ~get('res_table') WHERE state=~integer(~get('state_deleted'))",'L1','~fld('count') ~spell_plural(~spell_gender(~get('res[gender]'),'effacé')), '
)
~list(~get('database'),
"SELECT count(*) AS count from ~get('res_table') WHERE state=~integer(~get('state_archived'))",'L1','~fld('count') ~spell_plural(~spell_gender(~get('res[gender]'),'archivé')).
'
)
~if( ~file_exists('~getconf('templatedir')admin/~get('res_table').purge'),
~include('~get('res_table').purge')
)
~noeval('Get all deleted or purged res that have no link pointing to it')
~list(~get('database'),
"(SELECT ~get('res_table').id,
~get('res_table').~ifne( ~get('res[title_field]'),'title') AS title,
~get('res_table').state
FROM ~get('res_table')
LEFT JOIN ressources_ressources ON ressources_ressources.res_type_to=~get('res[type]') AND ressources_ressources.res_id_to=~get('res_table').id
WHERE
~get('res_table').state=~get('state_deleted')
AND ~get('res_table').update_timestamp <= DATE_SUB(CURRENT_TIMESTAMP(), interval 30 day)
AND ressources_ressources.res_type_from IS NULL
LIMIT 25
) UNION (
SELECT ~get('res_table').id,
~get('res_table').~ifne( ~get('res[title_field]'),'title') AS title,
~get('res_table').state
FROM ~get('res_table')
LEFT JOIN ressources_ressources ON ressources_ressources.res_type_to=~get('res[type]') AND ressources_ressources.res_id_to=~get('res_table').id
WHERE
~get('res_table').state=~get('state_purged')
AND ressources_ressources.res_type_from IS NULL
LIMIT 25
)",
'LD', 'Rien a faire!
',
'LM','Effacement ~get('res_table') #~fld('id'): ~fld('title')
~delete_comments( ~get('res[type]'), ~fld('id'))
~delete_users_lastseen( ~get('res[type]'), ~fld('id'))
~delete_urls( ~get('res[type]'), ~fld('id'))
~delete_moderated( ~get('res[type]'), ~fld('id'))
~delete_all_images( ~get('res[type]'), ~fld('id'))
~del_tags( ~get('res[type]'), ~fld('id'))
~delete_view_count( ~get('res[type]'), ~fld('id'))
~noeval('@todo check errors and delete if all is ok')
~include_res_command('delete', ~get('res_table'), ~fld('id'))
',
'LL', '~gfld('counter') ~mb_ucfirst(~spell_plural(~get('res_name'),~get('res[gender]'))) ~spell_plural(~spell_gender(~get('res[gender]'),'purgé'))!
'
)
~list(~get('database'),
"(SELECT ~get('res_table').id,
~get('res_table').~ifne( ~get('res[title_field]'),'title') AS title,
~get('res_table').state
FROM ~get('res_table')
LEFT JOIN ressources_ressources ON ressources_ressources.res_type_to=~get('res[type]') AND ressources_ressources.res_id_to=~get('res_table').id
WHERE
~get('res_table').state=~get('state_deleted')
AND ~get('res_table').update_timestamp <= DATE_SUB(CURRENT_TIMESTAMP(), interval 30 day)
AND ressources_ressources.res_type_from IS NOT NULL
LIMIT 25
) UNION (
SELECT ~get('res_table').id,
~get('res_table').~ifne( ~get('res[title_field]'),'title') AS title,
~get('res_table').state
FROM ~get('res_table')
LEFT JOIN ressources_ressources ON ressources_ressources.res_type_to=~get('res[type]') AND ressources_ressources.res_id_to=~get('res_table').id
WHERE
~get('res_table').state=~get('state_purged')
AND ressources_ressources.res_type_from IS NOT NULL
LIMIT 25
)",
'LF','Ressources effacables mais contenant des liens internes:
',
'LL', '
',
'LM',
'~strip_tags(~ifne(~fld('title'),'Pas de titre'))
'
)
~include("../site/admin.footer.tmpl")