Seite 1 von 1

[con4.9.11] Bug: Contenido.Upload.UploadPreprocess

Verfasst: Sa 7. Sep 2019, 23:38
von mattmarr
Hallo!

Ich glaub ich hab einen Bug gefunden.

Wenn ich den Chain UploadPreprocess nutze bekomme ich als Upload Pfad immer den Ordner "/contendo/data/temp" und nicht wie eigentlich vorgesehen den Ordner "/data/temp/". Ordner "/contendo/data/temp" exitstiert natürlich nicht. Selbst wenn ich diesen Händisch anlege meckert "include.upl_files_overview.php" an nächster stelle bei "rename(, PFAD);". Wobei bei "rename()" der Source-Pfad ($tmp_name) leer ist. :(

Ist das ein Bug oder mach ich etwas falsch?

Contenido Version 4.10 habe ich bisher noch nicht im Einsatz und konnte es auch nicht testen.


Gruß
Matthias

Re: [con4.9.11] Bug: Contenido.Upload.UploadPreprocess

Verfasst: Mo 9. Sep 2019, 09:44
von Oldperl
Servus Matthias,

ich habe jetzt nur 4.9.12 und 4.10 hier zum reinschauen, jedoch ist dort bei beiden die entsprechende Stelle gleich und sollte Dir eigentlich den Mandantenpfad zum Uploadordner oder den reinen Dbfs-Pfad bei Verwendung des Datenbanksystems liefern.
CONTENIDO_4.10.0/contenido/includes/include.upl_files_overview.php ab Zeile 261

Code: Alles auswählen

if ($_FILES['file']['tmp_name'][$key] != '') {
                    $tmp_name = $_FILES['file']['tmp_name'][$key];
                    $_cecIterator = $_cecRegistry->getIterator('Contenido.Upload.UploadPreprocess');

                    if ($_cecIterator->count() > 0) {
                        // Copy file to a temporary location
                        move_uploaded_file($tmp_name, $backendPath . $cfg['path']['temp'] . $_FILES['file']['name'][$key]);
                        $tmp_name = $backendPath . $cfg['path']['temp'] . $_FILES['file']['name'][$key];

                        while (false !== $chainEntry = $_cecIterator->next()) {
                            if (cApiDbfs::isDbfs($path)) {
                                $sPathPrepend = '';
                                $sPathAppend = '/';
                            } else {
                                $sPathPrepend = $cfgClient[$client]['upl']['path'];
                                $sPathAppend = '';
                            }

                            $modified = $chainEntry->execute($tmp_name, $sPathPrepend . $path . $sPathAppend . uplCreateFriendlyName($_FILES['file']['name'][$key]));
                            if ($modified !== false) {
                                $tmp_name = $modified;
                            }
                        }
                    }

                    if (cApiDbfs::isDbfs($qpath)) {
                        $dbfs->writeFromFile($tmp_name, $qpath . uplCreateFriendlyName($_FILES['file']['name'][$key]));
                        unlink($tmp_name);
                    } else {
                        if (is_uploaded_file($tmp_name)) {
                            $final_filename = $cfgClient[$client]['upl']['path'] . $path . uplCreateFriendlyName($_FILES['file']['name'][$key]);

                            move_uploaded_file($tmp_name, $final_filename);

                            $iterator = $_cecRegistry->getIterator('Contenido.Upload.UploadPostprocess');
                            while ($chainEntry = $iterator->next()) {
                                $chainEntry->execute($final_filename);
                            }
                        } else {
                            rename($tmp_name, $cfgClient[$client]['upl']['path'] . $path . uplCreateFriendlyName($_FILES['file']['name'][$key]));
                        }
                    }
                }
Warum bei Dir nun in der 4.9.11 der contenido-Pfad auftaucht kann ich so nicht beantworten, dazu fehlen mir genauere Infos zum System.

Gruß aus Franken

Ortwin

Re: [con4.9.11] Bug: Contenido.Upload.UploadPreprocess

Verfasst: Mo 9. Sep 2019, 09:50
von mattmarr
Hallo Ortwin

schau dir mal den Inhalt der Variable $backendPath genauer an. Was steht da drin bei dir?



Gruß
Matthias

Re: [con4.9.11] Bug: Contenido.Upload.UploadPreprocess

Verfasst: Mo 9. Sep 2019, 10:15
von Oldperl
Hallo Matthias,

CONTENIDO_4.10.0/contenido/includes/include.upl_files_overview.php Zeile 17

Code: Alles auswählen

$backendPath = cRegistry::getBackendPath();
Und in der Registry CONTENIDO_4.10.0/contenido/classes/class.registry.php ab Zeile 73

Code: Alles auswählen

public static function getBackendPath() {
        $cfg = self::getConfig();
        return $cfg['path']['contenido'];
    }
Was dem Eintrag in CONTENIDO_4.10.0/data/config/production/config.php ab Zeile 35

Code: Alles auswählen

/* The root server path where all frontends reside */
$cfg['path']['frontend']                = '/var/www/CONTENIDO_4.10.0';

/* The root server path to the CONTENIDO backend */
$cfg['path']['contenido']               = $cfg['path']['frontend'] . '/contenido/';
entspricht.

PS. Aber tracen kannst Du so etwas sicherlich auch selbst... 8)

Gruß aus Franken

Ortwin

Re: [con4.9.11] Bug: Contenido.Upload.UploadPreprocess

Verfasst: Mo 9. Sep 2019, 10:21
von mattmarr
Hallo Ortwin,
Oldperl hat geschrieben:
Mo 9. Sep 2019, 10:15

Was dem Eintrag in CONTENIDO_4.10.0/data/config/production/config.php ab Zeile 35

Code: Alles auswählen

/* The root server path where all frontends reside */
$cfg['path']['frontend']                = '/var/www/CONTENIDO_4.10.0';

/* The root server path to the CONTENIDO backend */
$cfg['path']['contenido']               = $cfg['path']['frontend'] . '/contenido/';
entspricht.
Bei mir kommt aus der Variable $cfg['path']['contenido'] immer das Falsche. Denn die Variable zeigt auf den Ordner "root/contenido/". Wie schon geschrieben, existiert dort aber kein "data" Ordner. Dieser liegt im Root der Installation.

Wenn ich einen Gedankenfehler im meinem wirren Hirn habe weist mich mit aller härte drauf hin. :)


Grüß
Matthias

Re: [con4.9.11] Bug: Contenido.Upload.UploadPreprocess

Verfasst: Mo 9. Sep 2019, 10:27
von Oldperl
Hallo Matthias,

könnte Dein "wirres Hirn" Deine Augen nochmal genau auf den Inhalt der Variable $cfg['path']['contenido'] schauen lassen? Denn dort steht nicht nur "/contenido/" drin, sondern davor auch der Inhalt der Variablen $cfg['path']['frontend'], also der absolute Pfad zu allen Frontends. :roll:

Gruß aus Franken

Ortwin

Re: [con4.9.11] Bug: Contenido.Upload.UploadPreprocess

Verfasst: Mo 9. Sep 2019, 10:30
von Oldperl
Upps, ja, nun sehe ich es auch :shock:
Das ist ein Bug, da das System den Temp-Ordner noch im contenido-Ordner sucht und nicht im neuen data-Ordner.

Gruß aus Franken

Ortwin

Re: [con4.9.11] Bug: Contenido.Upload.UploadPreprocess

Verfasst: Mo 9. Sep 2019, 11:05
von mattmarr
Hallo Ortwin,
Oldperl hat geschrieben:
Mo 9. Sep 2019, 10:30
Upps, ja, nun sehe ich es auch :shock:
Das ist ein Bug, da das System den Temp-Ordner noch im contenido-Ordner sucht und nicht im neuen data-Ordner.
Ja, im finden von Bugs bin ich Meister. :)



Gruß
Matthias

Re: [con4.9.11] Bug: Contenido.Upload.UploadPreprocess

Verfasst: Mo 9. Sep 2019, 11:53
von Oldperl
mattmarr hat geschrieben:
Mo 9. Sep 2019, 11:05
Ja, im finden von Bugs bin ich Meister. :)
Profi, Matthias, Profi! :wink:
Für den Meister muss man 3 1/2 Jahre auf die Meisterschule... :mrgreen:

Und hier von mir dann auch gleich der Bugfix. Ersetze Zeile 17 in CONTENIDO_4.10.0/contenido/includes/include.upl_files_overview.php durch

Code: Alles auswählen

$backendPath = cRegistry::getConfigValue('path', 'frontend')."/";
Gruß aus Franken

Ortwin

Re: [con4.9.11] Bug: Contenido.Upload.UploadPreprocess

Verfasst: Mo 9. Sep 2019, 13:21
von mattmarr
Danke für die Bestätigung des Bugs und deiner Lösung.


Gruß
Matthias