Moodle setup: Error code: missingconfigversion - postgresql

I am trying to set up my moodle site using postgresSQL locally. I am receiving this error after setup:
Config table does not contain version, can not continue, sorry.
More information about this error
It is usually not possible to recover from errors triggered during installation, you may need to create a new database or use a different database prefix if you want to retry the installation.
×Debug info:
Error code: missingconfigversion
×Stack trace:
line 495 of /lib/setuplib.php: moodle_exception thrown
line 287 of /admin/index.php: call to print_error()
The correct version IS in the database table mdl_config. I have also deleted the database and recreated it twice which seems to be the only advice I can find anywhere.
I have all the debugging settings turned on and am not receiving any more information.
Are there any other solutions to fixing this issue please?

If the table is there then it might be a database permission or the wrong database.
Maybe check the owner of mdl_config is the same as the $CFG->dbuser value in config.php
Also double check $CFG->dbname is the correct database name.
I use postgresql most of the time. These are the typical values in config.php
$CFG->dbtype = 'pgsql';
$CFG->dblibrary = 'native';
$CFG->dbhost = 'localhost';
$CFG->dbname = 'mydatabasename';
$CFG->dbuser = 'mydatabaseuser';
$CFG->dbpass = 'xxxxx';
$CFG->prefix = 'mdl_';
$CFG->dboptions = array (
'dbpersist' => 0,
'dbport' => '',
'dbsocket' => '',
);

Related

Moodle - update_moduleinfo - invalid course module id

I'm currently building a new moodle plugin. I'm using add_moduleinfo and update_moduleinfo. To add a new attandance atictivity in a course and update it later on.
Sadly I'm facing the issue that update_moduleinfo always throws an "invalid course module id" error. I already checked the cm entry in my database to ensure im using the right module instance.
I dont really know what to do.
$cm = get_coursemodule_from_instance($moduleName, $activityID, $course->id);
$moduleinfo = update_moduleinfo($cm, $moduleinfo, $course); <-- Error
Thats how I try to update the entry.
I also found that post. Didn't help anything.
Moodle - Invalid course module ID
I found the issue myself:
$moduleinfo->introeditor['format'] = FORMAT_HTML;
$moduleinfo->introeditor['text'] = "INTRO TEXT";
$moduleinfo->coursemodule = $cm->id;
list($cm, $moduleinfo) = update_moduleinfo($cm, $moduleinfo, $course, null);
In order to use this function the above mentioned properties need to exist in order to perform a update.

Cannot create temporary file at /usr/local/share/perl/5.22.1/RRDTool/OO.pm

I was trying to create RRD database for SNMP queries and as code shown below...
Code :
# Constructor
my $rrd = RRDTool::OO->new(file => "myrrdfile.rrd" );
# Create a round-robin database # one-second intervals
$rrd->create(
step => 1,
data_source => { name => "devicebatterylevel",
type => "GAUGE" },
archive => { rows => 1 });
$rrd->update($Batterylevel);
Output:
ERROR: rrdtool create myrrdfile.rrd --step 1 DS:mydatasource:GAUGE:2:U:U RRA:MAX:0.5:1:5 failed:
Cannot create temporary file at /usr/local/share/perl/5.22.1/RRDTool/OO.pm line 444
(Line break added for readability.)
Please guide me further.
Check that you have write permission to the current directory. Are you calling this script directly from the commandline, or from another application? If so, verify that the current working directory really is what you think it is. Also, check that your /tmp is not 100% full (unlikely).
Thanks for the reply.
I got the solution, the mistake is i didn't give wright access to file.
Now it's clear and script is working well.
Thanks and Regards,
Nayana

Adding message to IMAP folder using ZF3

I am trying to add a new message to IMAP folder using Zend Framework 3.
The code I use is the following:
...
$draftMessage = new \Zend\Mail\Storage\Message([
'headers' => [
'subject' => 'voyteck0#gmail.com',
],
'content' => 'ala ma kota',
]);
[valid-imap-connection]->appendMessage($draftMessage, 'Drafts', [\Zend\Mail\Storage::FLAG_DRAFT]);
...
However I always get an exception thrown:
Zend\Mail\Storage\Exception\RuntimeException:'cannot create message, please check if the folder exists and your flags' thrown in /.../zendframework/zend-mail/src/Storage/Imap.php(480)
I have also used in here a pseudo-element [valid-imap-connection] not to blur the problem - but the connection is working fine (retrieves messages, sends them, moves between folders etc.)
The folder exists - I have done some debuging even within ZF already and found out that in that line 480 the command returns NULL on the above code. If I change the folder into non-existing one - it returns false.
The Exception itself is thrown once (! result) - so null is also true for this condition.
However even if I am removing the code that throws exception (And the code completes execution with that NULL value) - still the message is not appearing in the folder (checking directly on the disk). There's nothing interesting in Dovecot logs (apart from the fact the connection is successfully established).
Any ideas highly welcome :)
I think the problem was with 2 things:
I should have used \Zend\Mail\Message class (not the ...\Storage... one)
The draftMessage should be a string version (actually dunno why - since appendMessage already uses toString() function)
So the code that works is following:
...
$draftMessage = new \Zend\Mail\Message();
$draftMessage->setSubject('voyteck0#gmail.com');
$draftMessage->setBody('ala ma kota');
[valid-imap-connection]->appendMessage($draftMessage->toString(), 'Drafts', [\Zend\Mail\Storage::FLAG_DRAFT]);
...

Crystal reports - server and database

Im using visual studio 2010 + Sql Server 2008.
Im trying to show my reports using CR.. well when i try to use the system in my local machine, everything is ok.
I use store procedures to create reports.
The issue appears when i deploy the system in another PC.. A message appears asking for:
Server: // RETRIEVES ORIGINAL Server(Local)// Its not Correct i need to get Client Server
Database: // RETRIEVES ORIGINAL DB(Local)// Its not Correct i need to get Client DB
Username: I don't use any user , what user ?
Password: I don't use any password, what password?
i saw another solutions, but i can't find what's the data that i must use in Username or password. i use Windows autenthication to login to sql..
Thanks.
Regards.
Edit.. that's my code.. i can't use parameters, i don't receive any error. but system dont recognize the parameter that i send...
Dim NuevoReporte As New CReportNotaPorUsuario
Dim contenido As String
Dim ReportPath As String = My.Application.Info.DirectoryPath & "\CReportNotaPorUsuario.rpt"
Dim ConexionCR As New CrystalDecisions.Shared.ConnectionInfo()
contenido = Servicios.Funciones_Auxiliares.LeerArchivo(My.Application.Info.DirectoryPath & "\configuracion.txt")
ConexionCR.ServerName = Servicios.Funciones_Auxiliares.TextoEntreMarcas(contenido, "<server>", "</server>")
ConexionCR.DatabaseName = Servicios.Funciones_Auxiliares.TextoEntreMarcas(contenido, "<catalog>", "</catalog>")
ConexionCR.IntegratedSecurity = True
CrystalReportViewer1.ReportSource = ReportPath
'NuevoReporte.SetParameterValue("#cod_usuario", cbousuario.SelectedValue)
Dim field1 As ParameterField = Me.CrystalReportViewer1.ParameterFieldInfo(0)
Dim val1 As New ParameterDiscreteValue()
val1.Value = cbousuario.SelectedValue
field1.CurrentValues.Add(val1)
SetDBLogonForReport(ConexionCR)
It appears that you have separate servers and databases between the development and production environment. You need to make sure when you deploy your VS solution that the production server and database get referenced, not the development server and database.
There are some tutorials out there that can help you find a way to achieve this. Check out:
http://msdn.microsoft.com/en-us/library/dd193254(v=vs.100).aspx
Visual Studio 2010 Database Project Deploy to Different Environments
http://www.asp.net/web-forms/tutorials/deployment/advanced-enterprise-web-deployment/customizing-database-deployments-for-multiple-environments
EDIT: This seems to have evolved into a different issue than originally stated in the question. To dynamically get the connection string for CR from the text file, you will have to read teh text file first and put server name and database name into variables. Reading a text file, you can use something like string text = File.ReadAllText(#"C:\Folder\File.txt"); but you will need to extract server name and database name into variables. Then in order to use the variables in your connection string you use ConnectionInfo.Servername = variable1; and ConnectionInfo.DatabaseName = variable2.

Zend_Auth fails to write to storage

I have yet another weird annoying thing going on with Zend.
Basically, I have the following code after creating a user domain:
$this->auth = Zend_Auth::getInstance();
$this->view->user = $this->user = $this->auth->getIdentity();
$this->user->idSite = $idSite;
$this->user->urlSite = $urlSite;
$this->auth->getStorage()->write($this->user);
What FURIOUSLY annoys me is that the auth->getIdentity() just moments after that:
[idSite] => 0
[urlSite] =>
So from here it gets worse: If I REFRESH or if any of the other parameters of the form fail and send me to the SAME FORM, but WITHOUT TOUCHING THE ABOVE SCRIPT, the auth-getIdentity() correctly returns:
[idSite] => 2431
[urlSite] => exampledomain
Which means that the code is correct and working, BUT if the form is filled out correctly and everything adds up nicely, I redirect to the next step: $this->_redirect('nextstep'), and neither idSite or urlSite remain empty forever.
Why is this? Why?
I've had the same issue and I think it is better to go via the route of using the session namespace functionality:
$oSession = new Zend_Session_Namespace('myStorage');
$oSession->foo = "bar";
$oSession->baz = 123;
And you can recover the data by:
$oSession = new Zend_Session_Namespace('myStorage');
$this->view->foo = $oSession->foo;
There are some more clues here: Zend_Auth the main message of which is that the storage of Zend_Auth data is actually just a namespace.
The default access to this would be similar to :
$oSession = new Zend_Session_Namespace('Zend_Auth');
I also had trouble with Zend_Auth not writing to storage. However, after seeing the answer by Ian Lewis and your response I realised it was probably writing ok, but not reading. I had previously changed the 'name' setting in my session to my own namespace. Once I removed this and started using the default again my Zend_Auth worked fine.