How many lines of code does Moodle have?
The short answer is: core Moodle 2.6 has about 600k lines of code + 3rd party libraries.

Now, the long answer.
A lot of the Moodle code are 3rd party libraries that are copied mostly under “lib” directory and some other places – I have counted those separately. I have also not counted *-min.js and *-debug.js files as duplicates.

After stripping from those, here is the statistic for the core code for the latest Moodle (2.7dev build: 20131122):

-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
PHP                           4462         125112         285162         564609
Javascript                     154           3856          10191          25478
CSS                            223           3411           1895          23375
XSD                             77           2304           4377          20071
XML                            133             43            127          15366
LESS                            25            443            407           7967
HTML                            46            268              7           3165
Perl                             2             57             76            535
MXML                             1             44             64            404
XSLT                             2             11             12            130
SQL                              1             26             31             92
DTD                              1              9              0             39
ActionScript                     1              6              1             33
-------------------------------------------------------------------------------
SUM:                          5128         135590         302350         661264
-------------------------------------------------------------------------------

Third party libraries account for:

-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
PHP                           1747          48352         176311         285443
Javascript                    1107          57787         145980         224760
CSS                            314           3290           3897          16268
HTML                            53            583             18           6242
XML                             23            553            237           5890
LESS                            41            810            942           4406
XSD                              5            108              6           1058
XSLT                             6            176             46            800
Java                             1             74             78            230
DTD                              2              0              0             82
-------------------------------------------------------------------------------
SUM:                          3299         111733         327515         545179
-------------------------------------------------------------------------------