Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,69 @@ Edit `composer.json` and

composer update --prefer-dist tsugi/lib

Making Changes and Contributing Back
-------------------------------------

This `tsugi/lib` directory is a git subtree that tracks the upstream repository
at [tsugiproject/tsugi-php](https://github.com/tsugiproject/tsugi-php). When you
make changes to files in this subtree, you can push those changes back to the
original repository as a pull request.

### Workflow for Contributing Changes

1. **Make your changes** in the `tsugi/lib` directory as you normally would.

2. **Commit your changes** in the parent repository:

git add tsugi/lib
git commit -m "Your commit message describing the changes"

3. **Push changes back to the upstream repository**:

First, ensure you have the upstream repository configured as a remote:

git remote add tsugi-php https://github.com/tsugiproject/tsugi-php.git

Then push the subtree changes to a branch in the upstream repository:

git subtree push --prefix=tsugi/lib tsugi-php your-branch-name

This will create a new branch `your-branch-name` in the upstream repository
with your changes.

4. **Create a Pull Request**:

- Navigate to https://github.com/tsugiproject/tsugi-php
- You should see a banner suggesting to create a PR from your new branch
- Click "Compare & pull request" and fill out the PR description
- Submit the PR for review

### Alternative: Using a Fork

If you prefer to work with a fork of the upstream repository:

1. **Fork the repository** at https://github.com/tsugiproject/tsugi-php

2. **Add your fork as a remote**:

git remote add tsugi-php-fork https://github.com/YOUR-USERNAME/tsugi-php.git

3. **Push to your fork**:

git subtree push --prefix=tsugi/lib tsugi-php-fork your-branch-name

4. **Create a PR** from your fork's branch to the upstream repository.

### Notes

- The `git subtree push` command extracts only the commits that affect files
in the `tsugi/lib` directory and creates a clean history in the upstream
repository.
- Make sure your commit messages are clear and descriptive, as they will be
preserved in the upstream repository.
- If you encounter conflicts during the push, you may need to pull the latest
changes from upstream first using `git subtree pull`.

Releasing
---------

Expand Down
11 changes: 6 additions & 5 deletions include/setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,14 @@ function print_stack_trace() {

if ( isset($CFG->upgrading) && $CFG->upgrading === true ) require_once("upgrading.php");

// The vendor include and root
if ( ! is_string($CFG->vendorroot) ) $CFG->vendorroot = $CFG->wwwroot."/vendor/tsugi/lib/util";
if ( ! is_string($CFG->vendorinclude) ) $CFG->vendorinclude = $CFG->dirroot."/vendor/tsugi/lib/include";
if ( ! is_string($CFG->vendorstatic) ) $CFG->vendorstatic = $CFG->dirroot."/vendor/tsugi/lib/static";
if ( is_string($CFG->staticroot) ) $CFG->staticroot = \Tsugi\Util\U::remove_relative_path($CFG->staticroot);

require_once $CFG->vendorinclude . "/lms_lib.php";
// Handle both cases: lib in parent directory structure vs standalone lib
$lms_lib_path = $CFG->dirroot."/lib/include/lms_lib.php";
if ( !file_exists($lms_lib_path) ) {
$lms_lib_path = $CFG->dirroot."/include/lms_lib.php";
}
require_once $lms_lib_path;

// Check to see if pre_config was included
// TODO: Make this a die() about a year after - Thu Nov 11 19:34:23 EST 2021
Expand Down
11 changes: 3 additions & 8 deletions src/Config/ConfigInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -767,14 +767,9 @@ class ConfigInfo {
*/
public $dbversion = false;

/*
* These are here to override the defaults for the vendor folder naming conventions
*
* It is unlikely you need to change these.
*/
public $vendorroot = false;
public $vendorinclude = false;
public $vendorstatic = false;
public $vendorinclude = false; // No longer used in the code base
public $vendorroot = false; // No longer used in the code base
public $vendorstatic = false; // No longer used in the code base

/**
* The autoloader to be used when loading classes.
Expand Down
17 changes: 1 addition & 16 deletions src/UI/Output.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,16 +178,7 @@ function header() {
top: 0px !important;
}
</style>
<?php } ?>

<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="<?= $CFG->vendorstatic ?>/js/html5shiv/html5shiv.js"></script>
<script src="<?= $CFG->vendorstatic ?>/js/respond/respond.min.js"></script>
<![endif]-->

<?php
<?php }
if ( $this->session_get('CSRF_TOKEN') ) {
echo('<script type="text/javascript">CSRF_TOKEN = "'.$this->session_get('CSRF_TOKEN').'";</script>'."\n");
} else {
Expand Down Expand Up @@ -535,17 +526,11 @@ function googleTranslateElementInit() {
public static function getUtilUrl($path)
{
global $CFG;
if ( isset($CFG->utilroot) ) {
return $CFG->utilroot.$path;
}

// From wwwroot
$path = str_replace('.php','',$path);
$retval = $CFG->wwwroot . '/util' . $path;
return $retval;

// The old way from "vendor"
// return $CFG->vendorroot.$path;
}

/**
Expand Down
8 changes: 0 additions & 8 deletions static/js/html5shiv/html5shiv.js

This file was deleted.

6 changes: 0 additions & 6 deletions static/js/respond/respond.matchmedia.addListener.min.js

This file was deleted.

Loading