protected function updateExtension(common_ext_Extension $ext)
    {
        helpers_ExtensionHelper::checkRequiredExtensions($ext);
        $installed = common_ext_ExtensionsManager::singleton()->getInstalledVersion($ext->getId());
        $codeVersion = $ext->getVersion();
        if ($installed !== $codeVersion) {
            $report = new common_report_Report(common_report_Report::TYPE_INFO, $ext->getName().' requires update from '.$installed.' to '.$codeVersion);
            $updaterClass = $ext->getManifest()->getUpdateHandler();
            if (is_null($updaterClass)) {
                $report = new common_report_Report(common_report_Report::TYPE_WARNING, 'No Updater found for  '.$ext->getName());
            } elseif (!class_exists($updaterClass)) {
                $report = new common_report_Report(common_report_Report::TYPE_ERROR, 'Updater '.$updaterClass.' not found');
            } else {
                $updater = new $updaterClass($ext);
                $returnedVersion = $updater->update($installed);
                $currentVersion = common_ext_ExtensionsManager::singleton()->getInstalledVersion($ext->getId());
                
                if (!is_null($returnedVersion) && $returnedVersion != $currentVersion) {
                    common_ext_ExtensionsManager::singleton()->updateVersion($ext, $returnedVersion);
                    $report->add(new common_report_Report(common_report_Report::TYPE_WARNING, 'Manually saved extension version'));
                    $currentVersion = $returnedVersion;
                }

                if ($currentVersion == $codeVersion) {
                    $versionReport = new common_report_Report(common_report_Report::TYPE_SUCCESS, 'Successfully updated '.$ext->getName().' to '.$currentVersion);
                } else {
                    $versionReport = new common_report_Report(common_report_Report::TYPE_WARNING, 'Update of '.$ext->getName().' exited with version '.$currentVersion);
                }

                foreach ($updater->getReports() as $updaterReport) {
                    $versionReport->add($updaterReport);
                }

                $report->add($versionReport);

                common_cache_FileCache::singleton()->purge();
            }
        } else {
            $report = new common_report_Report(common_report_Report::TYPE_INFO, $ext->getName().' already up to date');
        }
        return $report;
    }