Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors in MM 2 #3

Open
johannes-bittner opened this issue Nov 2, 2017 · 3 comments
Open

Errors in MM 2 #3

johannes-bittner opened this issue Nov 2, 2017 · 3 comments
Assignees

Comments

@johannes-bittner
Copy link

Running this script in a MM2 installation while upgrading from MM 1.x returns errors with the following functions that are removed in MM2:

line 161:
return \MetaModels\Factory::byTableName($nameOrId);
line 190:
$arrMetaModels = \MetaModels\Factory::getAllTables();

Is it possible to fix it? ;-)

@discordier
Copy link
Member

It is - however I wonder if it is worth the hassle as everyone should have upgraded already a long time ago.

@zonky2
Copy link

zonky2 commented Nov 3, 2017

@johannes-bittner pls write a part for MM manual

@zonky2
Copy link

zonky2 commented Nov 24, 2022

Alternative from https://community.contao.org/de/showthread.php?84149-Update-Images-von-MM-1-gt-2-x&p=565798&viewfull=1#post565798


$stmt = $dbConnect->prepare("SELECT * FROM mm_bilder WHERE images_backup != ''");
$stmt->execute();

$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);

for($i=0;$i<count($rows);$i++) {


    $oldImages = unserialize($rows[$i]['images_backup']);

    $newImages = array();

    foreach($oldImages AS $k => $v) {

                /***** Falls noch das ganz alte Verzeichnis tl_files verwendet sein sollte *****/
        $v = preg_replace('|tl_|', '', $v);

        $stmt = $dbConnect->prepare("SELECT uuid FROM tl_files WHERE tl_files.path = ?");
        $stmt->execute(array($v));

        $row = $stmt->fetchAll(PDO::FETCH_ASSOC);

        if(isset($row[0]['uuid'])) {
            $newImages[] = $row[0]['uuid'];
        }
        

    }

    if(count($newImages) > 0) {
        $newImages = serialize($newImages);

        $sqlUpdate = "UPDATE mm_bilder SET images = '".$newImages."' WHERE id = ".$rows[$i]['id'];
        $stmt = $dbConnect->prepare($sqlUpdate);
        $stmt->execute();
    }

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants