1

I have manually uninstalled an extension, but cant figure out the last part

  • Removed the Db Tables
  • Removed all traces from magento core tables
  • Removed the Design, skin, app, app/etc files
  • Removed from var/package
  • Flushed the cache

The extension is M2epro

Now magento connect says the extension is already installed (as i want to reinstall it) Where is it getting this info from?

4
  • Check if there is a file with a name similar to the extension in var/package. If there is (back it up and) delete it.
    – Marius
    Jul 30, 2013 at 13:44
  • I already did that with no luck
    – eleven11
    Jul 30, 2013 at 14:00
  • 2
    Sure you removed the entry from core_resource table?
    – Ashfame
    Jul 30, 2013 at 14:51
  • I guess you should ask M2EPro support team, they will provide you a good solution. And please update thread with your solution Jul 30, 2013 at 18:10

2 Answers 2

2

It could be getting this information from the table "core_resource", look for a module listed in that table with a name similar to m2epro_resource or m2epro_setup.

It uses this table to manage the installed versions of modules, try deleting the row for the module from that table and retry re-installation.

0

My answer is based on needing to do the whole process. I did the steps of my answer just now to get rid of an extension that splattered 157 files across my site. I normally install extensions via ssh shell as I don't trust automated installers. Plus I want to see how badly the install's shotgun blast is on my site.

To see what fields were added to which tables, download and expand the extension's tgz to a folder not on your website. Here's how to get the tgz. In this tgz's extracted folders, locate app/code/local/Company/Module/sql/ folders and their setup subfolders. In here are the php files with the SQL commands to add fields to tables. Two files in a package I just deleted are: mysql4-install-2.0.0.php and mysql4-upgrade-2.3.1-2.3.2.php Note that an extension may have multiple modules, so there may be multiple directories you need to search for those mysql4-install files.

After removing the extension's files from the site, you can review the tables and columns mentioned in the install files and drop those fields via mysql command line or via phpmyadmin.

Now, with the extension unpacked, run find . -type f at the base of the install folder created. This lists all the files in the archive. The next step is if you have customized the theme and are not using default/default, the find command's output won't be exactly correct for your site's installation.


I wrote a somewhat OCD php script which reads that files list and then looks for the files on your website itself. It tells you when it can't find files, so you can change the default/default to the more appropriate default/a034 etc.

So run find . -type f > Company_extention_files_list.txt and save it at your Magento installation's root folder, where the script below also goes.

The script has stages...
Stage 1 You place the script at the root of your site and edit the php script with the files list filename then load it in your browser. Once it has found all the files from the files list text file (which you must manually edit to change!)
Stage 2 it will then make a tar archive of those extension files it found. The filename of the target tar is a php variable you can change in the script.
Stage 3 Runs rm file on each of the files that were found and archived. This probably happens immediately once you successfully complete Stage 1 (because why would Stage 2 fail?).

Then it finishes the script with the tar -xzvf command to untar the archive should you have just broken your site. Clear your cache and viola.

Yes, I did this on my live site... no I didn't break it. Yes, I was nervous but ready; I had the tar -xzvf command copied and I also use git so worst case scenario, I can do a pull to restore files.

If you're paranoid, put exit(); between the stages, download the tarball the script makes, and extract it to make sure it's good. Yes, I did this, too

php script to remove an extension's files:

<?php
// used as base for the filenames below...
$extension_name = 'CO_Checkout';
 ?>
<style>
.red { color:#900; }
.gray { color:#999; }
.blue { color:#009; }
</style>
<pre><?php
// this is the input files list from unpacking the extension and running find command...
$filename = $extension_name.'_files_list.txt';

$tarFileList = $extension_name.'_tar_files.txt';
$tarball = $extension_name.'_pulled_from_production.tgz';
$span_red = 'class="red"'; $span_gray = 'class="gray"'; $span_blue = 'class="blue"';
$found = array();
$missing = array();
$handle = fopen($filename, "r");
if( $handle ) {
    while( ($line = fgets($handle)) !== false ) {
        $line=trim( $line, "/ .\n");
        $line=rtrim( $line );
        $line=str_replace( "\n", "", $line );
        $findme = $line; // dirname(__FILE__).'/'.$line;
        $command = "test -e $findme "; $output=""; $retval="";
        exec ( $command ,  &$output, &$retval  );
//      echo "$command returned $retval\n";
        if($retval > 0)
            $missing[]= $findme;
        else
            $found[]= $findme;
    }
} 
fclose($handle);

foreach( $missing as $file )
    echo "<span $span_red>$file</span>\n";
//foreach( $found as $file )
//  echo "<span $span_gray>$file</span>\n";

if( count( $missing ) > 0 )
    die( "Incomplete file list; ".count( $missing )." files not found!\nExiting before next stage.</pre>");

echo "Confirmed: ".count( $found )." files from original list are found.\n<span $span_gray>Attempting tar...</span>\n\n";

$_fileslist = implode( "\n", $found );
file_put_contents( $tarFileList, $_fileslist );

$command = "tar -czvf $tarball -T $tarFileList"; $output=""; $retval="";
exec ( $command ,  &$output, &$retval  );
if( $retval !== 0 )
    die( "$command <span $span_red>returned $retval</span>!\nExiting before next stage.</pre>");
else
    echo "$command <span $span_blue>returned $retval</span>\n\n";

// echo "\n\n".count( $output )."<b> files in output.</b>\n"; print_r( $output );

if( count( $found ) == count( $output ) )
    echo "Confirmed: ".count( $found )." files found and <span $span_blue>".count( $output )." files tar'd</span>.\n<span $span_gray>Deleting files from site now...</span>\n\n";
else
    die( "Wtf? ".count( $found )." != ".count( $output )."?!\n" );

$error=FALSE;
foreach( $found as $file_to_rm ){
    $command = "rm $file_to_rm"; $output=""; $retval="";
    exec ( $command ,  &$output, &$retval  );
    if( $retval !== 0 ) {
        echo "$command <span $span_red>returned $retval</span>!\n";
        $error = TRUE;
    } 
    else
        echo "<span $span_gray>$command returned $retval</span>\n";
}
echo "\n\n";

if( $error )
    echo "<span $span_red><b>There was an error!</b></span>\nCheck your site's functionality\n";
else
    echo "No errors, but better double check site's functions\n";

echo "\n\n<b>If something is broken,</b> run this command in the SSH quickly:\n\n";
echo "<h2>tar -xzvf $tarball</h2>\n";

?></pre>

Bonus round: this is the cache deletion script we've been using for a few years. Drop it in the website root or in /var somewhere and email yourself the URL. After installing or removing something, hit this script:

<pre><?php
$output;
$retval;
$errors="";
$command="pwd";
exec ( $command ,  &$output, &$retval  );
$path=$output[0];
unset($output);
echo "rm -rf $path/var/cache/*\n";
if( 1 ) {
    $command="rm -rf $path/var/cache/*";
    exec ( $command ,  &$output, &$retval  );
    echo "<b>$command</b> returned $retval\n";
    if($retval > 0)
        $errors .= "There was a problem deleting cache files.\n";
    // ------------------------------------------------
    $command="ls -alh $path/var/cache";
    exec ( $command ,  &$output, &$retval  );
    echo "<b>$command</b> returned $retval; the directory listing should only have . and ..\n\$output:";
    print_r($output);
    unset($output);
    // ------------------------------------------------
    $command="rm -rf $path/var/session/*";
    exec ( $command ,  &$output, &$retval  );
    echo "<b>$command</b> returned $retval\n";
    if($retval > 0)
        $errors .= "There was a problem deleting session files.\n";
    // ------------------------------------------------
    $command="ls -alh $path/var/session";
    exec ( $command ,  &$output, &$retval  );
    echo "<b>$command</b> returned $retval; the directory listing should only have . and ..\n\$output:";
    print_r($output);
    unset($output);
}
if( strlen($errors) == 0 )
    echo "<h2>Yaay! you can get into admin again...</h2>";
else
    echo "<h2 style=\"color:red\">Boo! something went wrong...</h2>$errors\n";
?></pre>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.