Hi Gordon,
Thanks for providing this, and apologies for the delayed response. I added
it to one of the application's controllers and wasn't able to get it to
successfully run. I'm able to get the initial section of code to echo to
screen, but once there are MapGuide functions, it fails.

This section of code works fine:
echo "Initializing web tier";
try {
    MgInitializeWebTier("DIR_PATH\Web\www\webconfig.ini");\
} catch (MgException $initEx) {
    echo "Init failure!";
    die;
} catch (Exception $ex) {
    echo "[php]: Exception: " . $ex->getMessage() . "\n";
    die;
}
echo "[php]: Initialized\n";
// We haven't and shouldn't need to require/include constants.php
// they are now baked into the PHP extension along with the other
// MapGuide API proxy classes
echo "[php]: Testing some constants\n";

The next line is where it fails:
echo "  - " . MgMimeType::Agf . "\n";

The error CodeIgniter's returning is:
Class "App\Controllers\Maptools\MgMimeType" not found

It seems like MapGuide functions aren't being recognized/loaded by
CodeIgniter. The MapGuideAPI is enabled in php.ini, and it shows as enabled
when I run info.php.

Any input would be greatly appreciated.

Thanks,
David

On Wed, Nov 12, 2025 at 11:05 AM Gordon Luckett <
[email protected]> wrote:

> Hi David
> When in doubt, I use Jackie's Sanity Check..
>
>
> https://themapguyde.blogspot.com/2022/04/mapguide-dev-diary-important.html?m=1
>
>
>
> On Wed, 12 Nov 2025, 10:39 David Bowen via mapguide-users, <
> [email protected]> wrote:
>
>> Our application is built using the Model/View/Controller (MVC) framework
>> CodeIgniter and I'm attempting to update the MVC framework from v3.1.13 to
>> v4.6.3, but I'm encountering an issue where it seems that one of the
>> MapGuide functions isn’t being loaded or recognized. The issue occurs
>> during the log out process, where a user logs out of the application and
>> there's a series of steps that take place to destroy the sessions (code
>> below).
>> I'm getting the following error when I attempt to log out of the
>> application: Call to undefined function
>> App\Controllers\Login\MgUserInformation(). This function,
>> MgUserInformation, is successfully called when the user first logs into the
>> application and a session is created, so I’m unclear what’s causing the
>> issue.
>> Does anyone have familiarity with MGOS and CodeIgniter 4, or would anyone
>> have suggestions on how to check if MGOS functions are being properly
>> loaded?
>> We're running MGOS 4 Beta 2 and are unable to go to MGOS 4 until we've
>> updated the MCV framework.
>>
>> Thanks,
>> David
>>
>> function logout() {
>>     //Log out and destroy session
>> $this->mgExtDir = getenv('mg_extensionsDir');
>>     $this->webconfig_ini = getenv( 'webconfigFilePath' );
>>     $this->mgMapID = $this->_getValueByFieldName( 'MAPNAME' );
>>     $this->mgSessionId = $this->_getValueByFieldName( 'SESSION' );
>>     try {
>>         // Initialize the Web Extensions and connect to the Server using
>>         // the Web Extensions session identifier stored in PHP session
>> state.
>>
>>         MgInitializeWebTier( $this->webconfig_ini );
>>         $si = $this->mgSessionId;
>>        // code fails on following line
>>         $userInfo = new MgUserInformation( $this->mgSessionId );
>>         $siteConnection = new MgSiteConnection();
>>         $siteConnection->Open( $userInfo );
>>
>>         $siteConnection->GetSite()->DestroySession( $this->mgSessionId );
>>     } catch ( MgException $e ) {
>>         echo $e->GetMessage();
>>         echo $e->GetDetails();
>>     }
>>     $session_dat = array( 'logged_in' => FALSE );
>>     session()->set( $session_dat );
>>     session()->destroy();
>>     return redirect()->to( 'login/login' ); //Direct user back to login
>> screen
>> }
>> _______________________________________________
>> mapguide-users mailing list
>> [email protected]
>> https://lists.osgeo.org/mailman/listinfo/mapguide-users
>>
>
_______________________________________________
mapguide-users mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/mapguide-users

Reply via email to