Score:0

Accidentally renamed a Composer file

pn flag

I found some answers suggesting ways to discover original file name but those seem to be irrelevant here, I wonder if anyone recognizes the content below and can suggest the original file name.

Original location is the parent folder of 'vendor'.

Thanks!

#!/usr/bin/env php
<?php
/*
 * This file is part of Composer.
 *
 * (c) Nils Adermann <naderman@naderman.de>
 *     Jordi Boggiano <j.boggiano@seld.be>
 *
 * For the full copyright and license information, please view
 * the license that is located at the bottom of this file.
 */

// Avoid APC causing random fatal errors per https://github.com/composer/composer/issues/264
if (extension_loaded('apc') && filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN) && filter_var(ini_get('apc.cache_by_default'), FILTER_VALIDATE_BOOLEAN)) {
    if (version_compare(phpversion('apc'), '3.0.12', '>=')) {
        ini_set('apc.cache_by_default', 0);
    } else {
        fwrite(STDERR, 'Warning: APC <= 3.0.12 may cause fatal errors when running composer commands.'.PHP_EOL);
        fwrite(STDERR, 'Update APC, or set apc.enable_cli or apc.cache_by_default to 0 in your php.ini.'.PHP_EOL);
    }
}

if (!class_exists('Phar')) {
    echo 'PHP\'s phar extension is missing. Composer requires it to run. Enable the extension or recompile php without --disable-phar then try again.' . PHP_EOL;
    exit(1);
}

Phar::mapPhar('composer.phar');
require 'phar://composer.phar/bin/composer';
Score:2
in flag

This question is more relevant in stackoverflow than askubuntu but I'll give it a shot

Searched https://github.com/composer/composer for the content of this file and found https://github.com/composer/composer/blob/main/src/Composer/Compiler.php

Based on that file I suspect the original filename was composer.phar

But to be sure, it's best you take your composer.json, install a fresh composer and run install - you should be able to find your file there

Side-note: an answer that might be fitting askubuntu is that you should try using git or another VCS to keep track of your files.

theYnot avatar
gb flag
Nice tidy answer, well done for identifying that it is likely better shared in another community. That and linking possible duplicates needs to be done more often.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.