Beispiel #1
0
        $homeResource = $modx->getObject('modResource', $homeId);
        if ($homeResource instanceof modResource) {
            $modx->resource = $homeResource;
        } else {
            echo "\nNo Resource\n";
        }
    }
} else {
    if (!$modx->user->hasSessionContext('mgr')) {
        die('Unauthorized Access');
    }
}
// include 'mycomponentproject.class.php';
$modx->lexicon->load('mycomponent:default');
require_once $modx->getOption('mc.core_path', null, $modx->getOption('core_path') . 'components/mycomponent/') . 'model/mycomponent/mycomponentproject.class.php';
$project = new MyComponentProject($modx);
$props = isset($scriptProperties) ? $scriptProperties : array();
$project->init($props);
$project->exportComponent(false);
$output = $project->helpers->getOutput();
// echo print_r(ObjectAdapter::$myObjects, true);
$output .= "\n\n" . $modx->lexicon('mc_initial_memory_used') . ': ' . round($mem_usage / 1048576, 2) . ' ' . $modx->lexicon('mc_megabytes');
$mem_usage = memory_get_usage();
$peak_usage = memory_get_peak_usage(true);
$output .= "\n" . $modx->lexicon('mc_final_memory_used') . ': ' . round($mem_usage / 1048576, 2) . ' ' . $modx->lexicon('mc_megabytes');
$output .= "\n" . $modx->lexicon('mc_peak_memory_used') . ': ' . round($peak_usage / 1048576, 2) . ' ' . $modx->lexicon('mc_megabytes');
/* report how long it took */
$mtime = microtime();
$mtime = explode(" ", $mtime);
$mtime = $mtime[1] + $mtime[0];
$tend = $mtime;
Beispiel #2
0
        $homeResource = $modx->getObject('modResource', $homeId);
        if ($homeResource instanceof modResource) {
            $modx->resource = $homeResource;
        } else {
            echo "\nNo Resource\n";
        }
    }
} else {
    if (!$modx->user->hasSessionContext('mgr')) {
        die('Unauthorized Access');
    }
}
require_once $modx->getOption('mc.core_path', null, $modx->getOption('core_path') . 'components/mycomponent/') . 'model/mycomponent/mycomponentproject.class.php';
// include 'mycomponentproject.class.php';
$modx->lexicon->load('mycomponent:default');
$project = new MyComponentProject($modx);
$project->init();
//$project->removeObjects();
$project->bootstrap();
$output = $project->helpers->getOutput();
// echo print_r(ObjectAdapter::$myObjects, true);
$output .= "\n\n" . $modx->lexicon('mc_initial_memory_used') . ': ' . round($mem_usage / 1048576, 2) . ' ' . $modx->lexicon('mc_megabytes');
$mem_usage = memory_get_usage();
$peak_usage = memory_get_peak_usage(true);
$output .= "\n" . $modx->lexicon('mc_final_memory_used') . ': ' . round($mem_usage / 1048576, 2) . ' ' . $modx->lexicon('mc_megabytes');
$output .= "\n" . $modx->lexicon('mc_peak_memory_used') . ': ' . round($peak_usage / 1048576, 2) . ' ' . $modx->lexicon('mc_megabytes');
/* report how long it took */
$mtime = microtime();
$mtime = explode(" ", $mtime);
$mtime = $mtime[1] + $mtime[0];
$tend = $mtime;
Beispiel #3
0
        if ($homeResource instanceof modResource) {
            $modx->resource = $homeResource;
        } else {
            echo "\nNo Resource\n";
        }
    }
} else {
    if (!$modx->user->hasSessionContext('mgr')) {
        die('Unauthorized Access');
    }
}
$modx->lexicon->load('mycomponent:default');
// include 'mycomponentproject.class.php';
require_once $modx->getOption('mc.core_path', null, $modx->getOption('core_path') . 'components/mycomponent/') . 'model/mycomponent/mycomponentproject.class.php';
$props = isset($scriptProperties) ? $scriptProperties : array();
$project = new MyComponentProject($modx);
$project->init($props);
//$project->removeObjects();
$dryRun = false;
/* true is the default -- set to false for actual import */
/* Comma-separated list of elements to process (snippets,plugins,chunks,templates) */
$toProcess = 'snippets,plugins,chunks,templates';
/* path to elements directory to import -- if empty, project's elements dir will be used */
/*$directory = $modx->getOption('mc.core', null,
  $modx->getOption('core_path') . 'components/example/') . 'elements/';*/
$directory = '';
$project->importObjects($toProcess, $directory, $dryRun);
$cm = $modx->getCacheManager();
$cm->refresh();
// echo print_r(ObjectAdapter::$myObjects, true);
$output = $project->helpers->getOutput();
Beispiel #4
0
        if ($homeResource instanceof modResource) {
            $modx->resource = $homeResource;
        } else {
            echo "\nNo Resource\n";
        }
    }
} else {
    if (!$modx->user->hasSessionContext('mgr')) {
        die('Unauthorized Access');
    }
}
$modx->lexicon->load('mycomponent:default');
// include 'mycomponent.project.php';
require_once $modx->getOption('mc.core_path', null, $modx->getOption('core_path') . 'components/mycomponent/') . 'model/mycomponent/mycomponentproject.class.php';
$props = isset($scriptProperties) ? $scriptProperties : array();
$project = new MyComponentProject($modx);
$project->init($props);
$dryRun = false;
/* true is the default -- set to false for actual import */
/* Comma-separated list of elements to process (snippets,plugins,chunks,templates) */
$toProcess = 'snippets,plugins,chunks,templates';
/* path to elements directory to import -- if empty, project's elements dir will be used */
/*$directory = $modx->getOption('mc.core', null,
  $modx->getOption('core_path') . 'components/example/') . 'elements/';*/
$directory = '';
$removeFiles = isset($scriptProperties['removeFiles']) && !empty($scriptProperties['removeFiles']);
$project->removeObjects($removeFiles);
$output = $project->helpers->getOutput();
$output .= "\n\n" . $modx->lexicon('mc_initial_memory_used') . ': ' . round($mem_usage / 1048576, 2) . ' ' . $modx->lexicon('mc_megabytes');
$mem_usage = memory_get_usage();
$peak_usage = memory_get_peak_usage(true);