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

Fragen zur Installation von CONTENIDO 4.9? Probleme bei der Konfiguration? Hinweise oder Fragen zur Entwicklung des Systemes oder zur Sicherheit?
Antworten
mattmarr
Beiträge: 361
Registriert: Mo 3. Aug 2009, 14:11
Kontaktdaten:

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

Beitrag von mattmarr » Sa 7. Sep 2019, 23:38

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
Zuletzt geändert von mattmarr am Mo 9. Sep 2019, 10:17, insgesamt 1-mal geändert.

Oldperl
Beiträge: 4250
Registriert: Do 30. Jun 2005, 22:56
Wohnort: Eltmann, Unterfranken, Bayern
Kontaktdaten:

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

Beitrag von Oldperl » Mo 9. Sep 2019, 09:44

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
ConLite 2.1, alternatives und stabiles Update von Contenido 4.8.x unter PHP 7.x - Download und Repo auf Gitport.de
phpBO Search Advanced - das Suchwort-Plugin für CONTENIDO 4.9
Mein Entwickler-Blog

mattmarr
Beiträge: 361
Registriert: Mo 3. Aug 2009, 14:11
Kontaktdaten:

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

Beitrag von mattmarr » Mo 9. Sep 2019, 09:50

Hallo Ortwin

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



Gruß
Matthias

Oldperl
Beiträge: 4250
Registriert: Do 30. Jun 2005, 22:56
Wohnort: Eltmann, Unterfranken, Bayern
Kontaktdaten:

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

Beitrag von Oldperl » Mo 9. Sep 2019, 10:15

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
ConLite 2.1, alternatives und stabiles Update von Contenido 4.8.x unter PHP 7.x - Download und Repo auf Gitport.de
phpBO Search Advanced - das Suchwort-Plugin für CONTENIDO 4.9
Mein Entwickler-Blog

mattmarr
Beiträge: 361
Registriert: Mo 3. Aug 2009, 14:11
Kontaktdaten:

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

Beitrag von mattmarr » Mo 9. Sep 2019, 10:21

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
Zuletzt geändert von mattmarr am Mo 9. Sep 2019, 10:31, insgesamt 1-mal geändert.

Oldperl
Beiträge: 4250
Registriert: Do 30. Jun 2005, 22:56
Wohnort: Eltmann, Unterfranken, Bayern
Kontaktdaten:

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

Beitrag von Oldperl » Mo 9. Sep 2019, 10:27

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
ConLite 2.1, alternatives und stabiles Update von Contenido 4.8.x unter PHP 7.x - Download und Repo auf Gitport.de
phpBO Search Advanced - das Suchwort-Plugin für CONTENIDO 4.9
Mein Entwickler-Blog

Oldperl
Beiträge: 4250
Registriert: Do 30. Jun 2005, 22:56
Wohnort: Eltmann, Unterfranken, Bayern
Kontaktdaten:

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

Beitrag von Oldperl » 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.

Gruß aus Franken

Ortwin
ConLite 2.1, alternatives und stabiles Update von Contenido 4.8.x unter PHP 7.x - Download und Repo auf Gitport.de
phpBO Search Advanced - das Suchwort-Plugin für CONTENIDO 4.9
Mein Entwickler-Blog

mattmarr
Beiträge: 361
Registriert: Mo 3. Aug 2009, 14:11
Kontaktdaten:

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

Beitrag von mattmarr » Mo 9. Sep 2019, 11:05

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

Oldperl
Beiträge: 4250
Registriert: Do 30. Jun 2005, 22:56
Wohnort: Eltmann, Unterfranken, Bayern
Kontaktdaten:

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

Beitrag von Oldperl » Mo 9. Sep 2019, 11:53

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
ConLite 2.1, alternatives und stabiles Update von Contenido 4.8.x unter PHP 7.x - Download und Repo auf Gitport.de
phpBO Search Advanced - das Suchwort-Plugin für CONTENIDO 4.9
Mein Entwickler-Blog

mattmarr
Beiträge: 361
Registriert: Mo 3. Aug 2009, 14:11
Kontaktdaten:

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

Beitrag von mattmarr » Mo 9. Sep 2019, 13:21

Danke für die Bestätigung des Bugs und deiner Lösung.


Gruß
Matthias

Antworten