<commit_before>#!/usr/bin/env php
<?php
/**
 * crazy script used to install or remove sonic extensions
 *
 * @author <NAME>
 */
use \Sonic\App;
$lib_path = str_replace('/util/extension.php', '/libs', realpath(__FILE__));

set_include_path($lib_path);

function usageAndExit()
{
    echo "./util/extension.php (install|upgrade|uninstall|reload) name-of-extension","\n\n";
    echo "-h,--help         shows this menu","\n";
    exit;
}

function getDirectoriesFor($file)
{
    $directories = array();
    $file = str_replace('libs/Sonic/', '', $file);
    $bits = explode('/', $file);
    $name = array_pop($bits);

    $last_dir = 'libs/Sonic';
    foreach ($bits as $bit) {
        $last_dir = $last_dir . '/' . $bit;
        $directories[] = $last_dir;
    }
    return $directories;
}

if (count($_SERVER['argv']) < 3 || in_array('-h', $_SERVER['argv']) || in_array('--help', $_SERVER['argv'])) {
    usageAndExit();
}

include 'Sonic/App.php';
$app = App::getInstance();
$app->addSetting(App::AUTOLOAD, true);
$app->start(App::COMMAND_LINE);

$type = $_SERVER['argv'][1];
$extension_name = $_SERVER['argv'][2];

$extension_path = $app->getPath('extensions') . '/' . $extension_name;

// make sure the extension exists
if ($type != 'uninstall' && !is_dir($extension_path)) {
    echo 'extension with name: ' . $extension_name . ' not found at path: ' . $app->getPath('extensions') . "\n";
    exit;
}<commit_msg>set the extension name to lowercase so that the same extension doesn't end up getting installed more than once<commit_after>#!/usr/bin/env php
<?php
/**
 * crazy script used to install or remove sonic extensions
 *
 * @author <NAME>
 */
use \Sonic\App;
$lib_path = str_replace('/util/extension.php', '/libs', realpath(__FILE__));

set_include_path($lib_path);

function usageAndExit()
{
    echo "./util/extension.php (install|upgrade|uninstall|reload) name-of-extension","\n\n";
    echo "-h,--help         shows this menu","\n";
    exit;
}

function getDirectoriesFor($file)
{
    $directories = array();
    $file = str_replace('libs/Sonic/', '', $file);
    $bits = explode('/', $file);
    $name = array_pop($bits);

    $last_dir = 'libs/Sonic';
    foreach ($bits as $bit) {
        $last_dir = $last_dir . '/' . $bit;
        $directories[] = $last_dir;
    }
    return $directories;
}

if (count($_SERVER['argv']) < 3 || in_array('-h', $_SERVER['argv']) || in_array('--help', $_SERVER['argv'])) {
    usageAndExit();
}

include 'Sonic/App.php';
$app = App::getInstance();
$app->addSetting(App::AUTOLOAD, true);
$app->start(App::COMMAND_LINE);

$type = $_SERVER['argv'][1];
$extension_name = strtolower($_SERVER['argv'][2]);

$extension_path = $app->getPath('extensions') . '/' . $extension_name;

// make sure the extension exists
if ($type != 'uninstall' && !is_dir($extension_path)) {
    echo 'extension with name: ' . $extension_name . ' not found at path: ' . $app->getPath('extensions') . "\n";
    exit;
}
{'fraction_non_alphanumeric': 0.20326864147088866, 'fraction_numerical': 0.0020429009193054137, 'mean_word_length': 3.9212730318257956, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4396566', 'n_tokens_mistral': 1013, 'n_tokens_neox': 1004, 'n_words': 220}