mirror of
https://github.com/Terranom674/Piwigo_Bratonien_Tools.git
synced 2026-09-19 19:54:31 +00:00
Compare commits
3 Commits
fix/09628-
...
fix/09629-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
298710e9d6 | ||
|
|
8f1162519e | ||
|
|
0f3c78f02c |
@@ -52,28 +52,11 @@ function bratonien_tools_nc_find_album($parent_id, $dir, $name, $excluded_site_i
|
|||||||
$where_parent = $parent_id === null ? 'id_uppercat IS NULL' : 'id_uppercat='.(int)$parent_id;
|
$where_parent = $parent_id === null ? 'id_uppercat IS NULL' : 'id_uppercat='.(int)$parent_id;
|
||||||
$dir_sql = pwg_db_real_escape_string((string)$dir);
|
$dir_sql = pwg_db_real_escape_string((string)$dir);
|
||||||
$name_sql = pwg_db_real_escape_string((string)$name);
|
$name_sql = pwg_db_real_escape_string((string)$name);
|
||||||
$query = '
|
$query = '\nSELECT id, dir, name\n FROM '.CATEGORIES_TABLE.'\n WHERE '.$where_parent.'\n AND (site_id IS NULL OR site_id <> '.(int)$excluded_site_id.')\n AND (\n dir = \\''.$dir_sql.'\\'\n OR LOWER(name) = LOWER(\\''.$name_sql.'\\')\n )\n ORDER BY CASE WHEN dir = \\''.$dir_sql.'\\' THEN 0 ELSE 1 END, id\n LIMIT 1\n;';
|
||||||
SELECT id, dir, name
|
|
||||||
FROM '.CATEGORIES_TABLE.'
|
|
||||||
WHERE '.$where_parent.'
|
|
||||||
AND (site_id IS NULL OR site_id <> '.(int)$excluded_site_id.')
|
|
||||||
AND (
|
|
||||||
dir = \''.$dir_sql.'\'
|
|
||||||
OR LOWER(name) = LOWER(\''.$name_sql.'\')
|
|
||||||
)
|
|
||||||
ORDER BY CASE WHEN dir = \''.$dir_sql.'\' THEN 0 ELSE 1 END, id
|
|
||||||
;';
|
|
||||||
$result = pwg_query($query);
|
$result = pwg_query($query);
|
||||||
$ids = array();
|
if (!pwg_db_num_rows($result)) return null;
|
||||||
while ($row = pwg_db_fetch_assoc($result))
|
$row = pwg_db_fetch_assoc($result);
|
||||||
{
|
return (int)$row['id'];
|
||||||
$ids[] = (int)$row['id'];
|
|
||||||
}
|
|
||||||
if (count($ids) > 1)
|
|
||||||
{
|
|
||||||
throw new RuntimeException('Albumzuordnung ist mehrdeutig fuer "'.$name.'".');
|
|
||||||
}
|
|
||||||
return count($ids) === 1 ? $ids[0] : null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function bratonien_tools_nc_ensure_album_path($relative_dir, $excluded_site_id, array &$cache, array &$created_ids)
|
function bratonien_tools_nc_ensure_album_path($relative_dir, $excluded_site_id, array &$cache, array &$created_ids)
|
||||||
@@ -175,10 +158,6 @@ function bratonien_tools_ws_nc_sync_productive($params, &$service)
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Older WebDAV builds created a complete physical album tree for their own
|
|
||||||
// Piwigo site. Remove that technical duplicate first. The WebDAV files are
|
|
||||||
// placeholders and are rebuilt independently, therefore database deletion
|
|
||||||
// must not remove the actual Nextcloud originals.
|
|
||||||
$counts['removed_duplicate_categories'] = bratonien_tools_nc_remove_storage_categories($site_id);
|
$counts['removed_duplicate_categories'] = bratonien_tools_nc_remove_storage_categories($site_id);
|
||||||
|
|
||||||
list($dbnow) = pwg_db_fetch_row(pwg_query('SELECT NOW()'));
|
list($dbnow) = pwg_db_fetch_row(pwg_query('SELECT NOW()'));
|
||||||
@@ -286,7 +265,6 @@ function bratonien_tools_ws_nc_sync_productive($params, &$service)
|
|||||||
$counts['new_elements'] = count($new_ids);
|
$counts['new_elements'] = count($new_ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Refresh the normal file attributes for connector-managed images only.
|
|
||||||
$updates = array();
|
$updates = array();
|
||||||
foreach ($all_ids as $id)
|
foreach ($all_ids as $id)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
Plugin Name: Bratonien Tools
|
Plugin Name: Bratonien Tools
|
||||||
Version: 0.9.6.28
|
Version: 0.9.6.29
|
||||||
Description: Erweiterbare Administrationswerkzeuge fuer die Bratonien-Piwigo-Installation.
|
Description: Erweiterbare Administrationswerkzeuge fuer die Bratonien-Piwigo-Installation.
|
||||||
Plugin URI: https://github.com/Terranom674/Piwigo_Bratonien_Tools
|
Plugin URI: https://github.com/Terranom674/Piwigo_Bratonien_Tools
|
||||||
Author: Bratonien
|
Author: Bratonien
|
||||||
|
|||||||
Reference in New Issue
Block a user